diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a55844d7..f500cca6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,13 @@ name: Build on: push: - + branches: + - release/rcnet-v1 + - develop + - main pull_request: branches: + - release/rcnet-v1 - develop - main @@ -21,75 +25,82 @@ jobs: custom-linker: "" custom-compiler: /usr/local/opt/llvm/bin/clang custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" + features: "jni,radix-engine" + - crate: native-json-interface + target-triple: x86_64-apple-ios + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + features: "jni,radix-engine" - crate: native-json-interface target-triple: x86_64-apple-darwin custom-linker: "" custom-compiler: /usr/local/opt/llvm/bin/clang custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" + features: "jni,radix-engine" - crate: native-json-interface target-triple: aarch64-apple-ios custom-linker: "" custom-compiler: /usr/local/opt/llvm/bin/clang custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" + features: "jni,radix-engine" - crate: native-json-interface target-triple: aarch64-apple-ios-sim custom-linker: "" custom-compiler: /usr/local/opt/llvm/bin/clang custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" + features: "jni,radix-engine" - crate: native-json-interface target-triple: x86_64-pc-windows-gnu custom-linker: "" custom-compiler: x86_64-w64-mingw32-gcc custom-archiver: x86_64-w64-mingw32-ar - features: "jni" + features: "jni,radix-engine" - crate: native-json-interface target-triple: x86_64-unknown-linux-gnu custom-linker: x86_64-unknown-linux-gnu-gcc custom-compiler: /usr/local/opt/llvm/bin/clang custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" + features: "jni,radix-engine" - crate: native-json-interface target-triple: aarch64-unknown-linux-gnu custom-linker: aarch64-unknown-linux-gnu-gcc custom-compiler: aarch64-unknown-linux-gnu-gcc custom-archiver: aarch64-unknown-linux-gnu-gcc-ar - features: "jni" + features: "jni,radix-engine" - crate: native-json-interface target-triple: i686-unknown-linux-gnu custom-linker: i686-unknown-linux-gnu-gcc custom-compiler: i686-unknown-linux-gnu-gcc custom-archiver: i686-unknown-linux-gnu-gcc-ar - features: "jni" + features: "jni,radix-engine" - crate: native-json-interface target-triple: wasm32-unknown-unknown custom-linker: "" custom-compiler: /usr/local/opt/llvm/bin/clang custom-archiver: /usr/local/opt/llvm/bin/llvm-ar - features: "jni" + features: "" - crate: native-json-interface target-triple: aarch64-linux-android - custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang - custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang - custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android-ar - features: "jni" + custom-linker: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang + custom-compiler: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android21-clang + custom-archiver: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar + features: "jni,radix-engine" - crate: native-json-interface target-triple: armv7-linux-androideabi - custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang - custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang - custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-ar - features: "jni" + custom-linker: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang + custom-compiler: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi19-clang + custom-archiver: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar + features: "jni,radix-engine" - crate: native-json-interface target-triple: i686-linux-android - custom-linker: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang - custom-compiler: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang - custom-archiver: $HOME/android-ndk/android-ndk-r22b/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android-ar - features: "jni" + custom-linker: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang + custom-compiler: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android19-clang + custom-archiver: /usr/local/share/android-ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar + features: "jni,radix-engine" steps: + - uses: FranzDiebold/github-env-vars-action@v2 - name: Checkout uses: actions/checkout@v3 @@ -99,13 +110,11 @@ jobs: brew install llvm brew install x86_64-unknown-linux-gnu brew install mingw-w64 + brew install --cask android-ndk brew tap messense/macos-cross-toolchains brew install aarch64-unknown-linux-gnu brew install i686-unknown-linux-gnu - - wget https://dl.google.com/android/repository/android-ndk-r22b-darwin-x86_64.zip - unzip -q android-ndk-r22b-darwin-x86_64.zip -d $HOME/android-ndk - name: Install Rust Toolchain run: | @@ -136,12 +145,23 @@ jobs: export CC=${{ matrix.build-target.custom-compiler }} export AR=${{ matrix.build-target.custom-archiver }} - export features=$${{ matrix.build-target.features }} - export features=${features:="default"} + + if [ -z "${{ matrix.build-target.features }}" ]; + then + echo "No special feature handling" + export features="" + else + export features="--features ${{ matrix.build-target.features }}" + echo "Special feature handling" + echo $features + fi - cargo build \ + cargo +nightly build \ + -Z build-std=std,panic_abort \ + -Z build-std-features=panic_immediate_abort \ --target ${{ matrix.build-target.target-triple }} \ - --release + --no-default-features \ + --release $features unset $LINKER_ENVIRONMENT_VARIABLE export CC="/usr/local/opt/llvm/bin/clang" @@ -177,6 +197,76 @@ jobs: name: "${{ matrix.build-target.crate }}-${{ matrix.build-target.target-triple }}.tar.gz" path: "./${{matrix.build-target.crate}}/target/${{ matrix.build-target.target-triple }}/release/${{ matrix.build-target.target-triple }}.tar.gz" + build-xc-framework: + needs: [build] + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - uses: actions/download-artifact@v3 + with: + path: artifacts + - name: Extract Artifacts + working-directory: artifacts + run: | + mkdir native + + for d in native-json-interface-*.tar.gz; do + mv ./$d/* ./native/ + done + + cd native + + for f in *.tar.gz; do + fn=`echo "$f" | cut -d'.' -f 1` + mkdir "$fn" + tar -xvzf "$f" --directory="$fn"; + done + + - name: Building XCFramework + working-directory: artifacts + run: | + cd native + + # The name of the crate that we are building + CRATE_NAME="native-json-interface" + + # Creating the two directories where the temporary FAT libraries will be stored + mkdir ./macos-arm64_x86_64/ + mkdir ./ios-simulator-arm64_x86_64 + + # Creating the fat libraries + lipo -create \ + "./aarch64-apple-darwin/libradix_engine_toolkit.a" \ + "./x86_64-apple-darwin/libradix_engine_toolkit.a" \ + -o "./macos-arm64_x86_64/libradix_engine_toolkit.a" + lipo -create \ + "./aarch64-apple-ios-sim/libradix_engine_toolkit.a" \ + "./x86_64-apple-ios/libradix_engine_toolkit.a" \ + -o "./ios-simulator-arm64_x86_64/libradix_engine_toolkit.a" + + # Copying the "include" directory from its origin into the fat library directory + cp -r ./aarch64-apple-darwin/include ./macos-arm64_x86_64/ + cp -r ./aarch64-apple-ios-sim/include ./ios-simulator-arm64_x86_64/ + + # Creating the XC Framework + xcodebuild -create-xcframework \ + -library "./aarch64-apple-ios/libradix_engine_toolkit.a" \ + -headers "./aarch64-apple-ios/include" \ + -library "./macos-arm64_x86_64/libradix_engine_toolkit.a" \ + -headers "./macos-arm64_x86_64/include" \ + -library "./ios-simulator-arm64_x86_64/libradix_engine_toolkit.a" \ + -headers "./ios-simulator-arm64_x86_64/include" \ + -output "./RadixEngineToolkit.xcframework" + + tar -czf "./RadixEngineToolkit.xcframework.tar.gz" ./RadixEngineToolkit.xcframework + + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: "RadixEngineToolkit.xcframework.tar.gz" + path: "./artifacts/native/RadixEngineToolkit.xcframework.tar.gz" + publish-csharp-nuget: needs: [build] runs-on: ubuntu-latest @@ -208,10 +298,11 @@ jobs: dotnet-version: 7.0.x - name: Configure Version run: | + CI_RUN_NUMBER=${{ github.run_number }} GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g') GIT_COMMIT=$(git log -1 --format=%h ) CORE_VERSION=$(cat radix-engine-toolkit/Cargo.toml | grep -e '^version' | cut -d'"' -f 2) - VERSION_SUFFIX=${GIT_BRANCH}-${GIT_COMMIT} + VERSION_SUFFIX=build.${CI_RUN_NUMBER} VERSION=${CORE_VERSION}-${VERSION_SUFFIX} if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c4cc139d..a4dcf7a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,4 +50,5 @@ jobs: for filename in $(find ./out/schema -type f -name "*.json" -exec basename {} \;); do cmp --quiet out/schema/$filename ./old-out/schema/$filename && exit 0 || exit 1 - done \ No newline at end of file + done + exit 0 \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..ad647571 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,28 @@ +{ + "rust-analyzer.linkedProjects": [ + "Cargo.toml", + "native-json-interface/Cargo.toml", + "cli-json-interface/Cargo.toml", + "benches/Cargo.toml", + ], + "cSpell.words": [ + "bech", + "Decompilation", + "decompile", + "decompiled", + "eddsa", + "instantiatable", + "Instrumenter", + "persistable", + "repr", + "Sbor", + "Scrypto", + "Secp", + "Substate", + "substates", + "Untimed", + "virtualizable", + "Wasmer", + "Wasmi" + ] +} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 46d2b912..5d634fa8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,5 +2,5 @@ members = [ "radix-engine-toolkit", "schema", - "serializable", + "toolkit-derive", ] \ No newline at end of file diff --git a/benches/Cargo.toml b/benches/Cargo.toml new file mode 100644 index 00000000..30971308 --- /dev/null +++ b/benches/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "benches" +version = "0.1.0" +edition = "2021" +build = "build.rs" + +[workspace] +members = [] + +[dependencies] +serde = "1.0.159" +serde_json = "1.0.95" + +radix-engine-toolkit = { path = "../radix-engine-toolkit" } + +[dev-dependencies] +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148", package = "transaction" } +criterion = "0.4.0" +hex = "0.4.3" + +[profile.bench] +debug = true +# lto = true +# codegen-units = 1 +# opt-level = 3 + +[[bench]] +name = "decompilation_benchmark" +harness = false \ No newline at end of file diff --git a/benches/benches/decompilation_benchmark.rs b/benches/benches/decompilation_benchmark.rs new file mode 100644 index 00000000..6399035f --- /dev/null +++ b/benches/benches/decompilation_benchmark.rs @@ -0,0 +1,171 @@ +use benches::{Invoke, RadixEngineToolkit}; +use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use native_transaction::{ + manifest::{compile, decompile}, + model::NotarizedTransaction, +}; +use radix_engine_toolkit::model::transaction::InstructionKind; +use radix_engine_toolkit::request::*; +use scrypto::{network::NetworkDefinition, prelude::manifest_decode}; + +fn decompile_intent_natively_benchmarks(c: &mut Criterion) { + let compiled_transaction = hex::decode(include_str!("./transaction.hex")).unwrap(); + + let mut group = c.benchmark_group("Decompile Intent Natively"); + group.sample_size(10); + + group.bench_function("SBOR Decode to NotarizedTransaction", |b| { + b.iter(|| { + black_box(manifest_decode::(&compiled_transaction).unwrap()) + }) + }); + group.bench_function("SBOR Decode to NotarizedTransaction and Decompile", |b| { + b.iter(|| { + black_box({ + let transaction = + manifest_decode::(&compiled_transaction).unwrap(); + decompile( + &transaction.signed_intent.intent.manifest.instructions, + &NetworkDefinition::simulator(), + ) + .unwrap() + }) + }) + }); + group.bench_function( + "SBOR Decode to NotarizedTransaction, Decompile, then Recompile", + |b| { + b.iter(|| { + black_box({ + let transaction = + manifest_decode::(&compiled_transaction).unwrap(); + let manifest = decompile( + &transaction.signed_intent.intent.manifest.instructions, + &NetworkDefinition::simulator(), + ) + .unwrap(); + compile(&manifest, &NetworkDefinition::simulator(), vec![]) + }) + }) + }, + ); + + group.finish(); +} + +fn decompile_intent_with_core_toolkit_benchmarks(c: &mut Criterion) { + let compiled_transaction = hex::decode(include_str!("./transaction.hex")).unwrap(); + + let mut group = c.benchmark_group("Decompile Intent with Toolkit Core"); + group.bench_function("Decompile Unknown Intent to String", |b| { + b.iter(|| { + black_box({ + let request = DecompileUnknownTransactionIntentRequest { + compiled_unknown_intent: compiled_transaction.clone(), + instructions_output_kind: InstructionKind::String, + }; + let response = DecompileUnknownTransactionIntentHandler::fulfill(request); + response.unwrap() + }) + }) + }); + group.bench_function("Decompile Unknown Intent to Parsed", |b| { + b.iter(|| { + black_box({ + let request = DecompileUnknownTransactionIntentRequest { + compiled_unknown_intent: compiled_transaction.clone(), + instructions_output_kind: InstructionKind::Parsed, + }; + let response = DecompileUnknownTransactionIntentHandler::fulfill(request); + response.unwrap() + }) + }) + }); + group.bench_function("Decompile Notarized Intent to String", |b| { + b.iter(|| { + black_box({ + let request = DecompileNotarizedTransactionRequest { + compiled_notarized_intent: compiled_transaction.clone(), + instructions_output_kind: InstructionKind::String, + }; + let response = DecompileNotarizedTransactionHandler::fulfill(request); + response.unwrap() + }) + }) + }); + group.bench_function("Decompile Notarized Intent to Parsed", |b| { + b.iter(|| { + black_box({ + let request = DecompileNotarizedTransactionRequest { + compiled_notarized_intent: compiled_transaction.clone(), + instructions_output_kind: InstructionKind::Parsed, + }; + let response = DecompileNotarizedTransactionHandler::fulfill(request); + response.unwrap() + }) + }) + }); + + group.finish(); +} + +fn decompile_intent_with_toolkit_wrapper_benchmarks(c: &mut Criterion) { + let compiled_transaction = hex::decode(include_str!("./transaction.hex")).unwrap(); + + let mut group = c.benchmark_group("Decompile Intent with Toolkit Wrapper"); + group.sample_size(10); + + group.bench_function("Decompile Unknown Intent to String", |b| { + b.iter(|| { + black_box( + RadixEngineToolkit::invoke(DecompileUnknownTransactionIntentRequest { + compiled_unknown_intent: compiled_transaction.clone(), + instructions_output_kind: InstructionKind::String, + }) + .unwrap(), + ) + }) + }); + group.bench_function("Decompile Unknown Intent to Parsed", |b| { + b.iter(|| { + black_box( + RadixEngineToolkit::invoke(DecompileUnknownTransactionIntentRequest { + compiled_unknown_intent: compiled_transaction.clone(), + instructions_output_kind: InstructionKind::Parsed, + }) + .unwrap(), + ) + }) + }); + group.bench_function("Decompile Notarized Intent to String", |b| { + b.iter(|| { + black_box( + RadixEngineToolkit::invoke(DecompileNotarizedTransactionRequest { + compiled_notarized_intent: compiled_transaction.clone(), + instructions_output_kind: InstructionKind::String, + }) + .unwrap(), + ) + }) + }); + group.bench_function("Decompile Notarized Intent to Parsed", |b| { + b.iter(|| { + black_box( + RadixEngineToolkit::invoke(DecompileNotarizedTransactionRequest { + compiled_notarized_intent: compiled_transaction.clone(), + instructions_output_kind: InstructionKind::Parsed, + }) + .unwrap(), + ) + }) + }); + + group.finish(); +} + +criterion_group!( + name = benches; + config = Criterion::default(); + targets = decompile_intent_natively_benchmarks, decompile_intent_with_toolkit_wrapper_benchmarks, decompile_intent_with_core_toolkit_benchmarks +); +criterion_main!(benches); diff --git a/benches/benches/transaction.hex b/benches/benches/transaction.hex new file mode 100644 index 00000000..470a7fa4 --- /dev/null +++ b/benches/benches/transaction.hex @@ -0,0 +1 @@ +4d2102210221022109070107220a3f050000000000000a4a050000000000000ae0ab8ab4f991510522000120072103a74d9e05834d6913aba6835b32b03fb39cbd0e739d63580ebeb6bb0aa5a8812301000900e1f505080500210220220321038004869696edc6120c67eb6f000a3e4e13d13ae10755e2f378ca9c250c086c6f636b5f6665652101850000e8890423c78a0000000000000000000000000000000000000000000000002004800000000000000000000000000000000000000000000000000000010c1a4e6f6e46756e6769626c655265736f757263654d616e616765720c1a6372656174655f776974685f696e697469616c5f737570706c792105220100210321032022002021002022002200010740200c00230c0c020b6465736372697074696f6e1b5573656420666f72206d756c74697661756c742074657374696e67046e616d650a4d7946756e546f6b656e2322210300000222020122000122000122000121028002000000000000000000000000000000000000000000000000000087021a440d31b0c16a178918a06a7a07882d69cf7cd963c0643bab85e922010001000222020122000122000122000121028002000000000000000000000000000000000000000000000000000087021a440d31b0c16a178918a06a7a07882d69cf7cd963c0643bab85e922010004000222020122000122000122000121028002000000000000000000000000000000000000000000000000000087021a440d31b0c16a178918a06a7a07882d69cf7cd963c0643bab85e9220100238721904e01000000000000000101210001000000000000000201210001000000000000000301210001000000000000000401210001000000000000000501210001000000000000000601210001000000000000000701210001000000000000000801210001000000000000000901210001000000000000000a01210001000000000000000b01210001000000000000000c01210001000000000000000d01210001000000000000000e01210001000000000000000f01210001000000000000001001210001000000000000001101210001000000000000001201210001000000000000001301210001000000000000001401210001000000000000001501210001000000000000001601210001000000000000001701210001000000000000001801210001000000000000001901210001000000000000001a01210001000000000000001b01210001000000000000001c01210001000000000000001d01210001000000000000001e01210001000000000000001f01210001000000000000002001210001000000000000002101210001000000000000002201210001000000000000002301210001000000000000002401210001000000000000002501210001000000000000002601210001000000000000002701210001000000000000002801210001000000000000002901210001000000000000002a01210001000000000000002b01210001000000000000002c01210001000000000000002d01210001000000000000002e01210001000000000000002f01210001000000000000003001210001000000000000003101210001000000000000003201210001000000000000003301210001000000000000003401210001000000000000003501210001000000000000003601210001000000000000003701210001000000000000003801210001000000000000003901210001000000000000003a01210001000000000000003b01210001000000000000003c01210001000000000000003d01210001000000000000003e01210001000000000000003f01210001000000000000004001210001000000000000004101210001000000000000004201210001000000000000004301210001000000000000004401210001000000000000004501210001000000000000004601210001000000000000004701210001000000000000004801210001000000000000004901210001000000000000004a01210001000000000000004b01210001000000000000004c01210001000000000000004d01210001000000000000004e01210001000000000000004f01210001000000000000005001210001000000000000005101210001000000000000005201210001000000000000005301210001000000000000005401210001000000000000005501210001000000000000005601210001000000000000005701210001000000000000005801210001000000000000005901210001000000000000005a01210001000000000000005b01210001000000000000005c01210001000000000000005d01210001000000000000005e01210001000000000000005f01210001000000000000006001210001000000000000006101210001000000000000006201210001000000000000006301210001000000000000006401210001000000000000006501210001000000000000006601210001000000000000006701210001000000000000006801210001000000000000006901210001000000000000006a01210001000000000000006b01210001000000000000006c01210001000000000000006d01210001000000000000006e01210001000000000000006f01210001000000000000007001210001000000000000007101210001000000000000007201210001000000000000007301210001000000000000007401210001000000000000007501210001000000000000007601210001000000000000007701210001000000000000007801210001000000000000007901210001000000000000007a01210001000000000000007b01210001000000000000007c01210001000000000000007d01210001000000000000007e01210001000000000000007f01210001000000000000008001210001000000000000008101210001000000000000008201210001000000000000008301210001000000000000008401210001000000000000008501210001000000000000008601210001000000000000008701210001000000000000008801210001000000000000008901210001000000000000008a01210001000000000000008b01210001000000000000008c01210001000000000000008d01210001000000000000008e01210001000000000000008f01210001000000000000009001210001000000000000009101210001000000000000009201210001000000000000009301210001000000000000009401210001000000000000009501210001000000000000009601210001000000000000009701210001000000000000009801210001000000000000009901210001000000000000009a01210001000000000000009b01210001000000000000009c01210001000000000000009d01210001000000000000009e01210001000000000000009f0121000100000000000000a00121000100000000000000a10121000100000000000000a20121000100000000000000a30121000100000000000000a40121000100000000000000a50121000100000000000000a60121000100000000000000a70121000100000000000000a80121000100000000000000a90121000100000000000000aa0121000100000000000000ab0121000100000000000000ac0121000100000000000000ad0121000100000000000000ae0121000100000000000000af0121000100000000000000b00121000100000000000000b10121000100000000000000b20121000100000000000000b30121000100000000000000b40121000100000000000000b50121000100000000000000b60121000100000000000000b70121000100000000000000b80121000100000000000000b90121000100000000000000ba0121000100000000000000bb0121000100000000000000bc0121000100000000000000bd0121000100000000000000be0121000100000000000000bf0121000100000000000000c00121000100000000000000c10121000100000000000000c20121000100000000000000c30121000100000000000000c40121000100000000000000c50121000100000000000000c60121000100000000000000c70121000100000000000000c80121000100000000000000c90121000100000000000000ca0121000100000000000000cb0121000100000000000000cc0121000100000000000000cd0121000100000000000000ce0121000100000000000000cf0121000100000000000000d00121000100000000000000d10121000100000000000000d20121000100000000000000d30121000100000000000000d40121000100000000000000d50121000100000000000000d60121000100000000000000d70121000100000000000000d80121000100000000000000d90121000100000000000000da0121000100000000000000db0121000100000000000000dc0121000100000000000000dd0121000100000000000000de0121000100000000000000df0121000100000000000000e00121000100000000000000e10121000100000000000000e20121000100000000000000e30121000100000000000000e40121000100000000000000e50121000100000000000000e60121000100000000000000e70121000100000000000000e80121000100000000000000e90121000100000000000000ea0121000100000000000000eb0121000100000000000000ec0121000100000000000000ed0121000100000000000000ee0121000100000000000000ef0121000100000000000000f00121000100000000000000f10121000100000000000000f20121000100000000000000f30121000100000000000000f40121000100000000000000f50121000100000000000000f60121000100000000000000f70121000100000000000000f80121000100000000000000f90121000100000000000000fa0121000100000000000000fb0121000100000000000000fc0121000100000000000000fd0121000100000000000000fe0121000100000000000000ff01210001000000000000010001210001000000000000010101210001000000000000010201210001000000000000010301210001000000000000010401210001000000000000010501210001000000000000010601210001000000000000010701210001000000000000010801210001000000000000010901210001000000000000010a01210001000000000000010b01210001000000000000010c01210001000000000000010d01210001000000000000010e01210001000000000000010f01210001000000000000011001210001000000000000011101210001000000000000011201210001000000000000011301210001000000000000011401210001000000000000011501210001000000000000011601210001000000000000011701210001000000000000011801210001000000000000011901210001000000000000011a01210001000000000000011b01210001000000000000011c01210001000000000000011d01210001000000000000011e01210001000000000000011f01210001000000000000012001210001000000000000012101210001000000000000012201210001000000000000012301210001000000000000012401210001000000000000012501210001000000000000012601210001000000000000012701210001000000000000012801210001000000000000012901210001000000000000012a01210001000000000000012b01210001000000000000012c01210001000000000000012d01210001000000000000012e01210001000000000000012f01210001000000000000013001210001000000000000013101210001000000000000013201210001000000000000013301210001000000000000013401210001000000000000013501210001000000000000013601210001000000000000013701210001000000000000013801210001000000000000013901210001000000000000013a01210001000000000000013b01210001000000000000013c01210001000000000000013d01210001000000000000013e01210001000000000000013f01210001000000000000014001210001000000000000014101210001000000000000014201210001000000000000014301210001000000000000014401210001000000000000014501210001000000000000014601210001000000000000014701210001000000000000014801210001000000000000014901210001000000000000014a01210001000000000000014b01210001000000000000014c01210001000000000000014d01210001000000000000014e01210001000000000000014f01210001000000000000015001210001000000000000015101210001000000000000015201210001000000000000015301210001000000000000015401210001000000000000015501210001000000000000015601210001000000000000015701210001000000000000015801210001000000000000015901210001000000000000015a01210001000000000000015b01210001000000000000015c01210001000000000000015d01210001000000000000015e01210001000000000000015f01210001000000000000016001210001000000000000016101210001000000000000016201210001000000000000016301210001000000000000016401210001000000000000016501210001000000000000016601210001000000000000016701210001000000000000016801210001000000000000016901210001000000000000016a01210001000000000000016b01210001000000000000016c01210001000000000000016d01210001000000000000016e01210001000000000000016f01210001000000000000017001210001000000000000017101210001000000000000017201210001000000000000017301210001000000000000017401210001000000000000017501210001000000000000017601210001000000000000017701210001000000000000017801210001000000000000017901210001000000000000017a01210001000000000000017b01210001000000000000017c01210001000000000000017d01210001000000000000017e01210001000000000000017f01210001000000000000018001210001000000000000018101210001000000000000018201210001000000000000018301210001000000000000018401210001000000000000018501210001000000000000018601210001000000000000018701210001000000000000018801210001000000000000018901210001000000000000018a01210001000000000000018b01210001000000000000018c01210001000000000000018d01210001000000000000018e01210001000000000000018f01210001000000000000019001210001000000000000019101210001000000000000019201210001000000000000019301210001000000000000019401210001000000000000019501210001000000000000019601210001000000000000019701210001000000000000019801210001000000000000019901210001000000000000019a01210001000000000000019b01210001000000000000019c01210001000000000000019d01210001000000000000019e01210001000000000000019f0121000100000000000001a00121000100000000000001a10121000100000000000001a20121000100000000000001a30121000100000000000001a40121000100000000000001a50121000100000000000001a60121000100000000000001a70121000100000000000001a80121000100000000000001a90121000100000000000001aa0121000100000000000001ab0121000100000000000001ac0121000100000000000001ad0121000100000000000001ae0121000100000000000001af0121000100000000000001b00121000100000000000001b10121000100000000000001b20121000100000000000001b30121000100000000000001b40121000100000000000001b50121000100000000000001b60121000100000000000001b70121000100000000000001b80121000100000000000001b90121000100000000000001ba0121000100000000000001bb0121000100000000000001bc0121000100000000000001bd0121000100000000000001be0121000100000000000001bf0121000100000000000001c00121000100000000000001c10121000100000000000001c20121000100000000000001c30121000100000000000001c40121000100000000000001c50121000100000000000001c60121000100000000000001c70121000100000000000001c80121000100000000000001c90121000100000000000001ca0121000100000000000001cb0121000100000000000001cc0121000100000000000001cd0121000100000000000001ce0121000100000000000001cf0121000100000000000001d00121000100000000000001d10121000100000000000001d20121000100000000000001d30121000100000000000001d40121000100000000000001d50121000100000000000001d60121000100000000000001d70121000100000000000001d80121000100000000000001d90121000100000000000001da0121000100000000000001db0121000100000000000001dc0121000100000000000001dd0121000100000000000001de0121000100000000000001df0121000100000000000001e00121000100000000000001e10121000100000000000001e20121000100000000000001e30121000100000000000001e40121000100000000000001e50121000100000000000001e60121000100000000000001e70121000100000000000001e80121000100000000000001e90121000100000000000001ea0121000100000000000001eb0121000100000000000001ec0121000100000000000001ed0121000100000000000001ee0121000100000000000001ef0121000100000000000001f00121000100000000000001f10121000100000000000001f20121000100000000000001f30121000100000000000001f40121000100000000000001f50121000100000000000001f60121000100000000000001f70121000100000000000001f80121000100000000000001f90121000100000000000001fa0121000100000000000001fb0121000100000000000001fc0121000100000000000001fd0121000100000000000001fe0121000100000000000001ff01210001000000000000020001210001000000000000020101210001000000000000020201210001000000000000020301210001000000000000020401210001000000000000020501210001000000000000020601210001000000000000020701210001000000000000020801210001000000000000020901210001000000000000020a01210001000000000000020b01210001000000000000020c01210001000000000000020d01210001000000000000020e01210001000000000000020f01210001000000000000021001210001000000000000021101210001000000000000021201210001000000000000021301210001000000000000021401210001000000000000021501210001000000000000021601210001000000000000021701210001000000000000021801210001000000000000021901210001000000000000021a01210001000000000000021b01210001000000000000021c01210001000000000000021d01210001000000000000021e01210001000000000000021f01210001000000000000022001210001000000000000022101210001000000000000022201210001000000000000022301210001000000000000022401210001000000000000022501210001000000000000022601210001000000000000022701210001000000000000022801210001000000000000022901210001000000000000022a01210001000000000000022b01210001000000000000022c01210001000000000000022d01210001000000000000022e01210001000000000000022f01210001000000000000023001210001000000000000023101210001000000000000023201210001000000000000023301210001000000000000023401210001000000000000023501210001000000000000023601210001000000000000023701210001000000000000023801210001000000000000023901210001000000000000023a01210001000000000000023b01210001000000000000023c01210001000000000000023d01210001000000000000023e01210001000000000000023f01210001000000000000024001210001000000000000024101210001000000000000024201210001000000000000024301210001000000000000024401210001000000000000024501210001000000000000024601210001000000000000024701210001000000000000024801210001000000000000024901210001000000000000024a01210001000000000000024b01210001000000000000024c01210001000000000000024d01210001000000000000024e01210001000000000000024f01210001000000000000025001210001000000000000025101210001000000000000025201210001000000000000025301210001000000000000025401210001000000000000025501210001000000000000025601210001000000000000025701210001000000000000025801210001000000000000025901210001000000000000025a01210001000000000000025b01210001000000000000025c01210001000000000000025d01210001000000000000025e01210001000000000000025f01210001000000000000026001210001000000000000026101210001000000000000026201210001000000000000026301210001000000000000026401210001000000000000026501210001000000000000026601210001000000000000026701210001000000000000026801210001000000000000026901210001000000000000026a01210001000000000000026b01210001000000000000026c01210001000000000000026d01210001000000000000026e01210001000000000000026f01210001000000000000027001210001000000000000027101210001000000000000027201210001000000000000027301210001000000000000027401210001000000000000027501210001000000000000027601210001000000000000027701210001000000000000027801210001000000000000027901210001000000000000027a01210001000000000000027b01210001000000000000027c01210001000000000000027d01210001000000000000027e01210001000000000000027f01210001000000000000028001210001000000000000028101210001000000000000028201210001000000000000028301210001000000000000028401210001000000000000028501210001000000000000028601210001000000000000028701210001000000000000028801210001000000000000028901210001000000000000028a01210001000000000000028b01210001000000000000028c01210001000000000000028d01210001000000000000028e01210001000000000000028f01210001000000000000029001210001000000000000029101210001000000000000029201210001000000000000029301210001000000000000029401210001000000000000029501210001000000000000029601210001000000000000029701210001000000000000029801210001000000000000029901210001000000000000029a01210001000000000000029b01210001000000000000029c01210001000000000000029d01210001000000000000029e01210001000000000000029f0121000100000000000002a00121000100000000000002a10121000100000000000002a20121000100000000000002a30121000100000000000002a40121000100000000000002a50121000100000000000002a60121000100000000000002a70121000100000000000002a80121000100000000000002a90121000100000000000002aa0121000100000000000002ab0121000100000000000002ac0121000100000000000002ad0121000100000000000002ae0121000100000000000002af0121000100000000000002b00121000100000000000002b10121000100000000000002b20121000100000000000002b30121000100000000000002b40121000100000000000002b50121000100000000000002b60121000100000000000002b70121000100000000000002b80121000100000000000002b90121000100000000000002ba0121000100000000000002bb0121000100000000000002bc0121000100000000000002bd0121000100000000000002be0121000100000000000002bf0121000100000000000002c00121000100000000000002c10121000100000000000002c20121000100000000000002c30121000100000000000002c40121000100000000000002c50121000100000000000002c60121000100000000000002c70121000100000000000002c80121000100000000000002c90121000100000000000002ca0121000100000000000002cb0121000100000000000002cc0121000100000000000002cd0121000100000000000002ce0121000100000000000002cf0121000100000000000002d00121000100000000000002d10121000100000000000002d20121000100000000000002d30121000100000000000002d40121000100000000000002d50121000100000000000002d60121000100000000000002d70121000100000000000002d80121000100000000000002d90121000100000000000002da0121000100000000000002db0121000100000000000002dc0121000100000000000002dd0121000100000000000002de0121000100000000000002df0121000100000000000002e00121000100000000000002e10121000100000000000002e20121000100000000000002e30121000100000000000002e40121000100000000000002e50121000100000000000002e60121000100000000000002e70121000100000000000002e80121000100000000000002e90121000100000000000002ea0121000100000000000002eb0121000100000000000002ec0121000100000000000002ed0121000100000000000002ee0121000100000000000002ef0121000100000000000002f00121000100000000000002f10121000100000000000002f20121000100000000000002f30121000100000000000002f40121000100000000000002f50121000100000000000002f60121000100000000000002f70121000100000000000002f80121000100000000000002f90121000100000000000002fa0121000100000000000002fb0121000100000000000002fc0121000100000000000002fd0121000100000000000002fe0121000100000000000002ff01210001000000000000030001210001000000000000030101210001000000000000030201210001000000000000030301210001000000000000030401210001000000000000030501210001000000000000030601210001000000000000030701210001000000000000030801210001000000000000030901210001000000000000030a01210001000000000000030b01210001000000000000030c01210001000000000000030d01210001000000000000030e01210001000000000000030f01210001000000000000031001210001000000000000031101210001000000000000031201210001000000000000031301210001000000000000031401210001000000000000031501210001000000000000031601210001000000000000031701210001000000000000031801210001000000000000031901210001000000000000031a01210001000000000000031b01210001000000000000031c01210001000000000000031d01210001000000000000031e01210001000000000000031f01210001000000000000032001210001000000000000032101210001000000000000032201210001000000000000032301210001000000000000032401210001000000000000032501210001000000000000032601210001000000000000032701210001000000000000032801210001000000000000032901210001000000000000032a01210001000000000000032b01210001000000000000032c01210001000000000000032d01210001000000000000032e01210001000000000000032f01210001000000000000033001210001000000000000033101210001000000000000033201210001000000000000033301210001000000000000033401210001000000000000033501210001000000000000033601210001000000000000033701210001000000000000033801210001000000000000033901210001000000000000033a01210001000000000000033b01210001000000000000033c01210001000000000000033d01210001000000000000033e01210001000000000000033f01210001000000000000034001210001000000000000034101210001000000000000034201210001000000000000034301210001000000000000034401210001000000000000034501210001000000000000034601210001000000000000034701210001000000000000034801210001000000000000034901210001000000000000034a01210001000000000000034b01210001000000000000034c01210001000000000000034d01210001000000000000034e01210001000000000000034f01210001000000000000035001210001000000000000035101210001000000000000035201210001000000000000035301210001000000000000035401210001000000000000035501210001000000000000035601210001000000000000035701210001000000000000035801210001000000000000035901210001000000000000035a01210001000000000000035b01210001000000000000035c01210001000000000000035d01210001000000000000035e01210001000000000000035f01210001000000000000036001210001000000000000036101210001000000000000036201210001000000000000036301210001000000000000036401210001000000000000036501210001000000000000036601210001000000000000036701210001000000000000036801210001000000000000036901210001000000000000036a01210001000000000000036b01210001000000000000036c01210001000000000000036d01210001000000000000036e01210001000000000000036f01210001000000000000037001210001000000000000037101210001000000000000037201210001000000000000037301210001000000000000037401210001000000000000037501210001000000000000037601210001000000000000037701210001000000000000037801210001000000000000037901210001000000000000037a01210001000000000000037b01210001000000000000037c01210001000000000000037d01210001000000000000037e01210001000000000000037f01210001000000000000038001210001000000000000038101210001000000000000038201210001000000000000038301210001000000000000038401210001000000000000038501210001000000000000038601210001000000000000038701210001000000000000038801210001000000000000038901210001000000000000038a01210001000000000000038b01210001000000000000038c01210001000000000000038d01210001000000000000038e01210001000000000000038f01210001000000000000039001210001000000000000039101210001000000000000039201210001000000000000039301210001000000000000039401210001000000000000039501210001000000000000039601210001000000000000039701210001000000000000039801210001000000000000039901210001000000000000039a01210001000000000000039b01210001000000000000039c01210001000000000000039d01210001000000000000039e01210001000000000000039f0121000100000000000003a00121000100000000000003a10121000100000000000003a20121000100000000000003a30121000100000000000003a40121000100000000000003a50121000100000000000003a60121000100000000000003a70121000100000000000003a80121000100000000000003a90121000100000000000003aa0121000100000000000003ab0121000100000000000003ac0121000100000000000003ad0121000100000000000003ae0121000100000000000003af0121000100000000000003b00121000100000000000003b10121000100000000000003b20121000100000000000003b30121000100000000000003b40121000100000000000003b50121000100000000000003b60121000100000000000003b70121000100000000000003b80121000100000000000003b90121000100000000000003ba0121000100000000000003bb0121000100000000000003bc0121000100000000000003bd0121000100000000000003be0121000100000000000003bf0121000100000000000003c00121000100000000000003c10121000100000000000003c20121000100000000000003c30121000100000000000003c40121000100000000000003c50121000100000000000003c60121000100000000000003c70121000100000000000003c80121000100000000000003c90121000100000000000003ca0121000100000000000003cb0121000100000000000003cc0121000100000000000003cd0121000100000000000003ce0121000100000000000003cf0121000100000000000003d00121000100000000000003d10121000100000000000003d20121000100000000000003d30121000100000000000003d40121000100000000000003d50121000100000000000003d60121000100000000000003d70121000100000000000003d80121000100000000000003d90121000100000000000003da0121000100000000000003db0121000100000000000003dc0121000100000000000003dd0121000100000000000003de0121000100000000000003df0121000100000000000003e00121000100000000000003e10121000100000000000003e20121000100000000000003e30121000100000000000003e40121000100000000000003e50121000100000000000003e60121000100000000000003e70121000100000000000003e80121000100000000000003e90121000100000000000003ea0121000100000000000003eb0121000100000000000003ec0121000100000000000003ed0121000100000000000003ee0121000100000000000003ef0121000100000000000003f00121000100000000000003f10121000100000000000003f20121000100000000000003f30121000100000000000003f40121000100000000000003f50121000100000000000003f60121000100000000000003f70121000100000000000003f80121000100000000000003f90121000100000000000003fa0121000100000000000003fb0121000100000000000003fc0121000100000000000003fd0121000100000000000003fe0121000100000000000003ff01210001000000000000040001210001000000000000040101210001000000000000040201210001000000000000040301210001000000000000040401210001000000000000040501210001000000000000040601210001000000000000040701210001000000000000040801210001000000000000040901210001000000000000040a01210001000000000000040b01210001000000000000040c01210001000000000000040d01210001000000000000040e01210001000000000000040f01210001000000000000041001210001000000000000041101210001000000000000041201210001000000000000041301210001000000000000041401210001000000000000041501210001000000000000041601210001000000000000041701210001000000000000041801210001000000000000041901210001000000000000041a01210001000000000000041b01210001000000000000041c01210001000000000000041d01210001000000000000041e01210001000000000000041f01210001000000000000042001210001000000000000042101210001000000000000042201210001000000000000042301210001000000000000042401210001000000000000042501210001000000000000042601210001000000000000042701210001000000000000042801210001000000000000042901210001000000000000042a01210001000000000000042b01210001000000000000042c01210001000000000000042d01210001000000000000042e01210001000000000000042f01210001000000000000043001210001000000000000043101210001000000000000043201210001000000000000043301210001000000000000043401210001000000000000043501210001000000000000043601210001000000000000043701210001000000000000043801210001000000000000043901210001000000000000043a01210001000000000000043b01210001000000000000043c01210001000000000000043d01210001000000000000043e01210001000000000000043f01210001000000000000044001210001000000000000044101210001000000000000044201210001000000000000044301210001000000000000044401210001000000000000044501210001000000000000044601210001000000000000044701210001000000000000044801210001000000000000044901210001000000000000044a01210001000000000000044b01210001000000000000044c01210001000000000000044d01210001000000000000044e01210001000000000000044f01210001000000000000045001210001000000000000045101210001000000000000045201210001000000000000045301210001000000000000045401210001000000000000045501210001000000000000045601210001000000000000045701210001000000000000045801210001000000000000045901210001000000000000045a01210001000000000000045b01210001000000000000045c01210001000000000000045d01210001000000000000045e01210001000000000000045f01210001000000000000046001210001000000000000046101210001000000000000046201210001000000000000046301210001000000000000046401210001000000000000046501210001000000000000046601210001000000000000046701210001000000000000046801210001000000000000046901210001000000000000046a01210001000000000000046b01210001000000000000046c01210001000000000000046d01210001000000000000046e01210001000000000000046f01210001000000000000047001210001000000000000047101210001000000000000047201210001000000000000047301210001000000000000047401210001000000000000047501210001000000000000047601210001000000000000047701210001000000000000047801210001000000000000047901210001000000000000047a01210001000000000000047b01210001000000000000047c01210001000000000000047d01210001000000000000047e01210001000000000000047f01210001000000000000048001210001000000000000048101210001000000000000048201210001000000000000048301210001000000000000048401210001000000000000048501210001000000000000048601210001000000000000048701210001000000000000048801210001000000000000048901210001000000000000048a01210001000000000000048b01210001000000000000048c01210001000000000000048d01210001000000000000048e01210001000000000000048f01210001000000000000049001210001000000000000049101210001000000000000049201210001000000000000049301210001000000000000049401210001000000000000049501210001000000000000049601210001000000000000049701210001000000000000049801210001000000000000049901210001000000000000049a01210001000000000000049b01210001000000000000049c01210001000000000000049d01210001000000000000049e01210001000000000000049f0121000100000000000004a00121000100000000000004a10121000100000000000004a20121000100000000000004a30121000100000000000004a40121000100000000000004a50121000100000000000004a60121000100000000000004a70121000100000000000004a80121000100000000000004a90121000100000000000004aa0121000100000000000004ab0121000100000000000004ac0121000100000000000004ad0121000100000000000004ae0121000100000000000004af0121000100000000000004b00121000100000000000004b10121000100000000000004b20121000100000000000004b30121000100000000000004b40121000100000000000004b50121000100000000000004b60121000100000000000004b70121000100000000000004b80121000100000000000004b90121000100000000000004ba0121000100000000000004bb0121000100000000000004bc0121000100000000000004bd0121000100000000000004be0121000100000000000004bf0121000100000000000004c00121000100000000000004c10121000100000000000004c20121000100000000000004c30121000100000000000004c40121000100000000000004c50121000100000000000004c60121000100000000000004c70121000100000000000004c80121000100000000000004c90121000100000000000004ca0121000100000000000004cb0121000100000000000004cc0121000100000000000004cd0121000100000000000004ce0121000100000000000004cf0121000100000000000004d00121000100000000000004d10121000100000000000004d20121000100000000000004d30121000100000000000004d40121000100000000000004d50121000100000000000004d60121000100000000000004d70121000100000000000004d80121000100000000000004d90121000100000000000004da0121000100000000000004db0121000100000000000004dc0121000100000000000004dd0121000100000000000004de0121000100000000000004df0121000100000000000004e00121000100000000000004e10121000100000000000004e20121000100000000000004e30121000100000000000004e40121000100000000000004e50121000100000000000004e60121000100000000000004e70121000100000000000004e80121000100000000000004e90121000100000000000004ea0121000100000000000004eb0121000100000000000004ec0121000100000000000004ed0121000100000000000004ee0121000100000000000004ef0121000100000000000004f00121000100000000000004f10121000100000000000004f20121000100000000000004f30121000100000000000004f40121000100000000000004f50121000100000000000004f60121000100000000000004f70121000100000000000004f80121000100000000000004f90121000100000000000004fa0121000100000000000004fb0121000100000000000004fc0121000100000000000004fd0121000100000000000004fe0121000100000000000004ff01210001000000000000050001210001000000000000050101210001000000000000050201210001000000000000050301210001000000000000050401210001000000000000050501210001000000000000050601210001000000000000050701210001000000000000050801210001000000000000050901210001000000000000050a01210001000000000000050b01210001000000000000050c01210001000000000000050d01210001000000000000050e01210001000000000000050f01210001000000000000051001210001000000000000051101210001000000000000051201210001000000000000051301210001000000000000051401210001000000000000051501210001000000000000051601210001000000000000051701210001000000000000051801210001000000000000051901210001000000000000051a01210001000000000000051b01210001000000000000051c01210001000000000000051d01210001000000000000051e01210001000000000000051f01210001000000000000052001210001000000000000052101210001000000000000052201210001000000000000052301210001000000000000052401210001000000000000052501210001000000000000052601210001000000000000052701210001000000000000052801210001000000000000052901210001000000000000052a01210001000000000000052b01210001000000000000052c01210001000000000000052d01210001000000000000052e01210001000000000000052f01210001000000000000053001210001000000000000053101210001000000000000053201210001000000000000053301210001000000000000053401210001000000000000053501210001000000000000053601210001000000000000053701210001000000000000053801210001000000000000053901210001000000000000053a01210001000000000000053b01210001000000000000053c01210001000000000000053d01210001000000000000053e01210001000000000000053f01210001000000000000054001210001000000000000054101210001000000000000054201210001000000000000054301210001000000000000054401210001000000000000054501210001000000000000054601210001000000000000054701210001000000000000054801210001000000000000054901210001000000000000054a01210001000000000000054b01210001000000000000054c01210001000000000000054d01210001000000000000054e01210001000000000000054f01210001000000000000055001210001000000000000055101210001000000000000055201210001000000000000055301210001000000000000055401210001000000000000055501210001000000000000055601210001000000000000055701210001000000000000055801210001000000000000055901210001000000000000055a01210001000000000000055b01210001000000000000055c01210001000000000000055d01210001000000000000055e01210001000000000000055f01210001000000000000056001210001000000000000056101210001000000000000056201210001000000000000056301210001000000000000056401210001000000000000056501210001000000000000056601210001000000000000056701210001000000000000056801210001000000000000056901210001000000000000056a01210001000000000000056b01210001000000000000056c01210001000000000000056d01210001000000000000056e01210001000000000000056f01210001000000000000057001210001000000000000057101210001000000000000057201210001000000000000057301210001000000000000057401210001000000000000057501210001000000000000057601210001000000000000057701210001000000000000057801210001000000000000057901210001000000000000057a01210001000000000000057b01210001000000000000057c01210001000000000000057d01210001000000000000057e01210001000000000000057f01210001000000000000058001210001000000000000058101210001000000000000058201210001000000000000058301210001000000000000058401210001000000000000058501210001000000000000058601210001000000000000058701210001000000000000058801210001000000000000058901210001000000000000058a01210001000000000000058b01210001000000000000058c01210001000000000000058d01210001000000000000058e01210001000000000000058f01210001000000000000059001210001000000000000059101210001000000000000059201210001000000000000059301210001000000000000059401210001000000000000059501210001000000000000059601210001000000000000059701210001000000000000059801210001000000000000059901210001000000000000059a01210001000000000000059b01210001000000000000059c01210001000000000000059d01210001000000000000059e01210001000000000000059f0121000100000000000005a00121000100000000000005a10121000100000000000005a20121000100000000000005a30121000100000000000005a40121000100000000000005a50121000100000000000005a60121000100000000000005a70121000100000000000005a80121000100000000000005a90121000100000000000005aa0121000100000000000005ab0121000100000000000005ac0121000100000000000005ad0121000100000000000005ae0121000100000000000005af0121000100000000000005b00121000100000000000005b10121000100000000000005b20121000100000000000005b30121000100000000000005b40121000100000000000005b50121000100000000000005b60121000100000000000005b70121000100000000000005b80121000100000000000005b90121000100000000000005ba0121000100000000000005bb0121000100000000000005bc0121000100000000000005bd0121000100000000000005be0121000100000000000005bf0121000100000000000005c00121000100000000000005c10121000100000000000005c20121000100000000000005c30121000100000000000005c40121000100000000000005c50121000100000000000005c60121000100000000000005c70121000100000000000005c80121000100000000000005c90121000100000000000005ca0121000100000000000005cb0121000100000000000005cc0121000100000000000005cd0121000100000000000005ce0121000100000000000005cf0121000100000000000005d00121000100000000000005d10121000100000000000005d20121000100000000000005d30121000100000000000005d40121000100000000000005d50121000100000000000005d60121000100000000000005d70121000100000000000005d80121000100000000000005d90121000100000000000005da0121000100000000000005db0121000100000000000005dc0121000100000000000005dd0121000100000000000005de0121000100000000000005df0121000100000000000005e00121000100000000000005e10121000100000000000005e20121000100000000000005e30121000100000000000005e40121000100000000000005e50121000100000000000005e60121000100000000000005e70121000100000000000005e80121000100000000000005e90121000100000000000005ea0121000100000000000005eb0121000100000000000005ec0121000100000000000005ed0121000100000000000005ee0121000100000000000005ef0121000100000000000005f00121000100000000000005f10121000100000000000005f20121000100000000000005f30121000100000000000005f40121000100000000000005f50121000100000000000005f60121000100000000000005f70121000100000000000005f80121000100000000000005f90121000100000000000005fa0121000100000000000005fb0121000100000000000005fc0121000100000000000005fd0121000100000000000005fe0121000100000000000005ff01210001000000000000060001210001000000000000060101210001000000000000060201210001000000000000060301210001000000000000060401210001000000000000060501210001000000000000060601210001000000000000060701210001000000000000060801210001000000000000060901210001000000000000060a01210001000000000000060b01210001000000000000060c01210001000000000000060d01210001000000000000060e01210001000000000000060f01210001000000000000061001210001000000000000061101210001000000000000061201210001000000000000061301210001000000000000061401210001000000000000061501210001000000000000061601210001000000000000061701210001000000000000061801210001000000000000061901210001000000000000061a01210001000000000000061b01210001000000000000061c01210001000000000000061d01210001000000000000061e01210001000000000000061f01210001000000000000062001210001000000000000062101210001000000000000062201210001000000000000062301210001000000000000062401210001000000000000062501210001000000000000062601210001000000000000062701210001000000000000062801210001000000000000062901210001000000000000062a01210001000000000000062b01210001000000000000062c01210001000000000000062d01210001000000000000062e01210001000000000000062f01210001000000000000063001210001000000000000063101210001000000000000063201210001000000000000063301210001000000000000063401210001000000000000063501210001000000000000063601210001000000000000063701210001000000000000063801210001000000000000063901210001000000000000063a01210001000000000000063b01210001000000000000063c01210001000000000000063d01210001000000000000063e01210001000000000000063f01210001000000000000064001210001000000000000064101210001000000000000064201210001000000000000064301210001000000000000064401210001000000000000064501210001000000000000064601210001000000000000064701210001000000000000064801210001000000000000064901210001000000000000064a01210001000000000000064b01210001000000000000064c01210001000000000000064d01210001000000000000064e01210001000000000000064f01210001000000000000065001210001000000000000065101210001000000000000065201210001000000000000065301210001000000000000065401210001000000000000065501210001000000000000065601210001000000000000065701210001000000000000065801210001000000000000065901210001000000000000065a01210001000000000000065b01210001000000000000065c01210001000000000000065d01210001000000000000065e01210001000000000000065f01210001000000000000066001210001000000000000066101210001000000000000066201210001000000000000066301210001000000000000066401210001000000000000066501210001000000000000066601210001000000000000066701210001000000000000066801210001000000000000066901210001000000000000066a01210001000000000000066b01210001000000000000066c01210001000000000000066d01210001000000000000066e01210001000000000000066f01210001000000000000067001210001000000000000067101210001000000000000067201210001000000000000067301210001000000000000067401210001000000000000067501210001000000000000067601210001000000000000067701210001000000000000067801210001000000000000067901210001000000000000067a01210001000000000000067b01210001000000000000067c01210001000000000000067d01210001000000000000067e01210001000000000000067f01210001000000000000068001210001000000000000068101210001000000000000068201210001000000000000068301210001000000000000068401210001000000000000068501210001000000000000068601210001000000000000068701210001000000000000068801210001000000000000068901210001000000000000068a01210001000000000000068b01210001000000000000068c01210001000000000000068d01210001000000000000068e01210001000000000000068f01210001000000000000069001210001000000000000069101210001000000000000069201210001000000000000069301210001000000000000069401210001000000000000069501210001000000000000069601210001000000000000069701210001000000000000069801210001000000000000069901210001000000000000069a01210001000000000000069b01210001000000000000069c01210001000000000000069d01210001000000000000069e01210001000000000000069f0121000100000000000006a00121000100000000000006a10121000100000000000006a20121000100000000000006a30121000100000000000006a40121000100000000000006a50121000100000000000006a60121000100000000000006a70121000100000000000006a80121000100000000000006a90121000100000000000006aa0121000100000000000006ab0121000100000000000006ac0121000100000000000006ad0121000100000000000006ae0121000100000000000006af0121000100000000000006b00121000100000000000006b10121000100000000000006b20121000100000000000006b30121000100000000000006b40121000100000000000006b50121000100000000000006b60121000100000000000006b70121000100000000000006b80121000100000000000006b90121000100000000000006ba0121000100000000000006bb0121000100000000000006bc0121000100000000000006bd0121000100000000000006be0121000100000000000006bf0121000100000000000006c00121000100000000000006c10121000100000000000006c20121000100000000000006c30121000100000000000006c40121000100000000000006c50121000100000000000006c60121000100000000000006c70121000100000000000006c80121000100000000000006c90121000100000000000006ca0121000100000000000006cb0121000100000000000006cc0121000100000000000006cd0121000100000000000006ce0121000100000000000006cf0121000100000000000006d00121000100000000000006d10121000100000000000006d20121000100000000000006d30121000100000000000006d40121000100000000000006d50121000100000000000006d60121000100000000000006d70121000100000000000006d80121000100000000000006d90121000100000000000006da0121000100000000000006db0121000100000000000006dc0121000100000000000006dd0121000100000000000006de0121000100000000000006df0121000100000000000006e00121000100000000000006e10121000100000000000006e20121000100000000000006e30121000100000000000006e40121000100000000000006e50121000100000000000006e60121000100000000000006e70121000100000000000006e80121000100000000000006e90121000100000000000006ea0121000100000000000006eb0121000100000000000006ec0121000100000000000006ed0121000100000000000006ee0121000100000000000006ef0121000100000000000006f00121000100000000000006f10121000100000000000006f20121000100000000000006f30121000100000000000006f40121000100000000000006f50121000100000000000006f60121000100000000000006f70121000100000000000006f80121000100000000000006f90121000100000000000006fa0121000100000000000006fb0121000100000000000006fc0121000100000000000006fd0121000100000000000006fe0121000100000000000006ff01210001000000000000070001210001000000000000070101210001000000000000070201210001000000000000070301210001000000000000070401210001000000000000070501210001000000000000070601210001000000000000070701210001000000000000070801210001000000000000070901210001000000000000070a01210001000000000000070b01210001000000000000070c01210001000000000000070d01210001000000000000070e01210001000000000000070f01210001000000000000071001210001000000000000071101210001000000000000071201210001000000000000071301210001000000000000071401210001000000000000071501210001000000000000071601210001000000000000071701210001000000000000071801210001000000000000071901210001000000000000071a01210001000000000000071b01210001000000000000071c01210001000000000000071d01210001000000000000071e01210001000000000000071f01210001000000000000072001210001000000000000072101210001000000000000072201210001000000000000072301210001000000000000072401210001000000000000072501210001000000000000072601210001000000000000072701210001000000000000072801210001000000000000072901210001000000000000072a01210001000000000000072b01210001000000000000072c01210001000000000000072d01210001000000000000072e01210001000000000000072f01210001000000000000073001210001000000000000073101210001000000000000073201210001000000000000073301210001000000000000073401210001000000000000073501210001000000000000073601210001000000000000073701210001000000000000073801210001000000000000073901210001000000000000073a01210001000000000000073b01210001000000000000073c01210001000000000000073d01210001000000000000073e01210001000000000000073f01210001000000000000074001210001000000000000074101210001000000000000074201210001000000000000074301210001000000000000074401210001000000000000074501210001000000000000074601210001000000000000074701210001000000000000074801210001000000000000074901210001000000000000074a01210001000000000000074b01210001000000000000074c01210001000000000000074d01210001000000000000074e01210001000000000000074f01210001000000000000075001210001000000000000075101210001000000000000075201210001000000000000075301210001000000000000075401210001000000000000075501210001000000000000075601210001000000000000075701210001000000000000075801210001000000000000075901210001000000000000075a01210001000000000000075b01210001000000000000075c01210001000000000000075d01210001000000000000075e01210001000000000000075f01210001000000000000076001210001000000000000076101210001000000000000076201210001000000000000076301210001000000000000076401210001000000000000076501210001000000000000076601210001000000000000076701210001000000000000076801210001000000000000076901210001000000000000076a01210001000000000000076b01210001000000000000076c01210001000000000000076d01210001000000000000076e01210001000000000000076f01210001000000000000077001210001000000000000077101210001000000000000077201210001000000000000077301210001000000000000077401210001000000000000077501210001000000000000077601210001000000000000077701210001000000000000077801210001000000000000077901210001000000000000077a01210001000000000000077b01210001000000000000077c01210001000000000000077d01210001000000000000077e01210001000000000000077f01210001000000000000078001210001000000000000078101210001000000000000078201210001000000000000078301210001000000000000078401210001000000000000078501210001000000000000078601210001000000000000078701210001000000000000078801210001000000000000078901210001000000000000078a01210001000000000000078b01210001000000000000078c01210001000000000000078d01210001000000000000078e01210001000000000000078f01210001000000000000079001210001000000000000079101210001000000000000079201210001000000000000079301210001000000000000079401210001000000000000079501210001000000000000079601210001000000000000079701210001000000000000079801210001000000000000079901210001000000000000079a01210001000000000000079b01210001000000000000079c01210001000000000000079d01210001000000000000079e01210001000000000000079f0121000100000000000007a00121000100000000000007a10121000100000000000007a20121000100000000000007a30121000100000000000007a40121000100000000000007a50121000100000000000007a60121000100000000000007a70121000100000000000007a80121000100000000000007a90121000100000000000007aa0121000100000000000007ab0121000100000000000007ac0121000100000000000007ad0121000100000000000007ae0121000100000000000007af0121000100000000000007b00121000100000000000007b10121000100000000000007b20121000100000000000007b30121000100000000000007b40121000100000000000007b50121000100000000000007b60121000100000000000007b70121000100000000000007b80121000100000000000007b90121000100000000000007ba0121000100000000000007bb0121000100000000000007bc0121000100000000000007bd0121000100000000000007be0121000100000000000007bf0121000100000000000007c00121000100000000000007c10121000100000000000007c20121000100000000000007c30121000100000000000007c40121000100000000000007c50121000100000000000007c60121000100000000000007c70121000100000000000007c80121000100000000000007c90121000100000000000007ca0121000100000000000007cb0121000100000000000007cc0121000100000000000007cd0121000100000000000007ce0121000100000000000007cf0121000100000000000007d00121000100000000000007d10121000100000000000007d20121000100000000000007d30121000100000000000007d40121000100000000000007d50121000100000000000007d60121000100000000000007d70121000100000000000007d80121000100000000000007d90121000100000000000007da0121000100000000000007db0121000100000000000007dc0121000100000000000007dd0121000100000000000007de0121000100000000000007df0121000100000000000007e00121000100000000000007e10121000100000000000007e20121000100000000000007e30121000100000000000007e40121000100000000000007e50121000100000000000007e60121000100000000000007e70121000100000000000007e80121000100000000000007e90121000100000000000007ea0121000100000000000007eb0121000100000000000007ec0121000100000000000007ed0121000100000000000007ee0121000100000000000007ef0121000100000000000007f00121000100000000000007f10121000100000000000007f20121000100000000000007f30121000100000000000007f40121000100000000000007f50121000100000000000007f60121000100000000000007f70121000100000000000007f80121000100000000000007f90121000100000000000007fa0121000100000000000007fb0121000100000000000007fc0121000100000000000007fd0121000100000000000007fe0121000100000000000007ff01210001000000000000080001210001000000000000080101210001000000000000080201210001000000000000080301210001000000000000080401210001000000000000080501210001000000000000080601210001000000000000080701210001000000000000080801210001000000000000080901210001000000000000080a01210001000000000000080b01210001000000000000080c01210001000000000000080d01210001000000000000080e01210001000000000000080f01210001000000000000081001210001000000000000081101210001000000000000081201210001000000000000081301210001000000000000081401210001000000000000081501210001000000000000081601210001000000000000081701210001000000000000081801210001000000000000081901210001000000000000081a01210001000000000000081b01210001000000000000081c01210001000000000000081d01210001000000000000081e01210001000000000000081f01210001000000000000082001210001000000000000082101210001000000000000082201210001000000000000082301210001000000000000082401210001000000000000082501210001000000000000082601210001000000000000082701210001000000000000082801210001000000000000082901210001000000000000082a01210001000000000000082b01210001000000000000082c01210001000000000000082d01210001000000000000082e01210001000000000000082f01210001000000000000083001210001000000000000083101210001000000000000083201210001000000000000083301210001000000000000083401210001000000000000083501210001000000000000083601210001000000000000083701210001000000000000083801210001000000000000083901210001000000000000083a01210001000000000000083b01210001000000000000083c01210001000000000000083d01210001000000000000083e01210001000000000000083f01210001000000000000084001210001000000000000084101210001000000000000084201210001000000000000084301210001000000000000084401210001000000000000084501210001000000000000084601210001000000000000084701210001000000000000084801210001000000000000084901210001000000000000084a01210001000000000000084b01210001000000000000084c01210001000000000000084d01210001000000000000084e01210001000000000000084f01210001000000000000085001210001000000000000085101210001000000000000085201210001000000000000085301210001000000000000085401210001000000000000085501210001000000000000085601210001000000000000085701210001000000000000085801210001000000000000085901210001000000000000085a01210001000000000000085b01210001000000000000085c01210001000000000000085d01210001000000000000085e01210001000000000000085f01210001000000000000086001210001000000000000086101210001000000000000086201210001000000000000086301210001000000000000086401210001000000000000086501210001000000000000086601210001000000000000086701210001000000000000086801210001000000000000086901210001000000000000086a01210001000000000000086b01210001000000000000086c01210001000000000000086d01210001000000000000086e01210001000000000000086f01210001000000000000087001210001000000000000087101210001000000000000087201210001000000000000087301210001000000000000087401210001000000000000087501210001000000000000087601210001000000000000087701210001000000000000087801210001000000000000087901210001000000000000087a01210001000000000000087b01210001000000000000087c01210001000000000000087d01210001000000000000087e01210001000000000000087f01210001000000000000088001210001000000000000088101210001000000000000088201210001000000000000088301210001000000000000088401210001000000000000088501210001000000000000088601210001000000000000088701210001000000000000088801210001000000000000088901210001000000000000088a01210001000000000000088b01210001000000000000088c01210001000000000000088d01210001000000000000088e01210001000000000000088f01210001000000000000089001210001000000000000089101210001000000000000089201210001000000000000089301210001000000000000089401210001000000000000089501210001000000000000089601210001000000000000089701210001000000000000089801210001000000000000089901210001000000000000089a01210001000000000000089b01210001000000000000089c01210001000000000000089d01210001000000000000089e01210001000000000000089f0121000100000000000008a00121000100000000000008a10121000100000000000008a20121000100000000000008a30121000100000000000008a40121000100000000000008a50121000100000000000008a60121000100000000000008a70121000100000000000008a80121000100000000000008a90121000100000000000008aa0121000100000000000008ab0121000100000000000008ac0121000100000000000008ad0121000100000000000008ae0121000100000000000008af0121000100000000000008b00121000100000000000008b10121000100000000000008b20121000100000000000008b30121000100000000000008b40121000100000000000008b50121000100000000000008b60121000100000000000008b70121000100000000000008b80121000100000000000008b90121000100000000000008ba0121000100000000000008bb0121000100000000000008bc0121000100000000000008bd0121000100000000000008be0121000100000000000008bf0121000100000000000008c00121000100000000000008c10121000100000000000008c20121000100000000000008c30121000100000000000008c40121000100000000000008c50121000100000000000008c60121000100000000000008c70121000100000000000008c80121000100000000000008c90121000100000000000008ca0121000100000000000008cb0121000100000000000008cc0121000100000000000008cd0121000100000000000008ce0121000100000000000008cf0121000100000000000008d00121000100000000000008d10121000100000000000008d20121000100000000000008d30121000100000000000008d40121000100000000000008d50121000100000000000008d60121000100000000000008d70121000100000000000008d80121000100000000000008d90121000100000000000008da0121000100000000000008db0121000100000000000008dc0121000100000000000008dd0121000100000000000008de0121000100000000000008df0121000100000000000008e00121000100000000000008e10121000100000000000008e20121000100000000000008e30121000100000000000008e40121000100000000000008e50121000100000000000008e60121000100000000000008e70121000100000000000008e80121000100000000000008e90121000100000000000008ea0121000100000000000008eb0121000100000000000008ec0121000100000000000008ed0121000100000000000008ee0121000100000000000008ef0121000100000000000008f00121000100000000000008f10121000100000000000008f20121000100000000000008f30121000100000000000008f40121000100000000000008f50121000100000000000008f60121000100000000000008f70121000100000000000008f80121000100000000000008f90121000100000000000008fa0121000100000000000008fb0121000100000000000008fc0121000100000000000008fd0121000100000000000008fe0121000100000000000008ff01210001000000000000090001210001000000000000090101210001000000000000090201210001000000000000090301210001000000000000090401210001000000000000090501210001000000000000090601210001000000000000090701210001000000000000090801210001000000000000090901210001000000000000090a01210001000000000000090b01210001000000000000090c01210001000000000000090d01210001000000000000090e01210001000000000000090f01210001000000000000091001210001000000000000091101210001000000000000091201210001000000000000091301210001000000000000091401210001000000000000091501210001000000000000091601210001000000000000091701210001000000000000091801210001000000000000091901210001000000000000091a01210001000000000000091b01210001000000000000091c01210001000000000000091d01210001000000000000091e01210001000000000000091f01210001000000000000092001210001000000000000092101210001000000000000092201210001000000000000092301210001000000000000092401210001000000000000092501210001000000000000092601210001000000000000092701210001000000000000092801210001000000000000092901210001000000000000092a01210001000000000000092b01210001000000000000092c01210001000000000000092d01210001000000000000092e01210001000000000000092f01210001000000000000093001210001000000000000093101210001000000000000093201210001000000000000093301210001000000000000093401210001000000000000093501210001000000000000093601210001000000000000093701210001000000000000093801210001000000000000093901210001000000000000093a01210001000000000000093b01210001000000000000093c01210001000000000000093d01210001000000000000093e01210001000000000000093f01210001000000000000094001210001000000000000094101210001000000000000094201210001000000000000094301210001000000000000094401210001000000000000094501210001000000000000094601210001000000000000094701210001000000000000094801210001000000000000094901210001000000000000094a01210001000000000000094b01210001000000000000094c01210001000000000000094d01210001000000000000094e01210001000000000000094f01210001000000000000095001210001000000000000095101210001000000000000095201210001000000000000095301210001000000000000095401210001000000000000095501210001000000000000095601210001000000000000095701210001000000000000095801210001000000000000095901210001000000000000095a01210001000000000000095b01210001000000000000095c01210001000000000000095d01210001000000000000095e01210001000000000000095f01210001000000000000096001210001000000000000096101210001000000000000096201210001000000000000096301210001000000000000096401210001000000000000096501210001000000000000096601210001000000000000096701210001000000000000096801210001000000000000096901210001000000000000096a01210001000000000000096b01210001000000000000096c01210001000000000000096d01210001000000000000096e01210001000000000000096f01210001000000000000097001210001000000000000097101210001000000000000097201210001000000000000097301210001000000000000097401210001000000000000097501210001000000000000097601210001000000000000097701210001000000000000097801210001000000000000097901210001000000000000097a01210001000000000000097b01210001000000000000097c01210001000000000000097d01210001000000000000097e01210001000000000000097f01210001000000000000098001210001000000000000098101210001000000000000098201210001000000000000098301210001000000000000098401210001000000000000098501210001000000000000098601210001000000000000098701210001000000000000098801210001000000000000098901210001000000000000098a01210001000000000000098b01210001000000000000098c01210001000000000000098d01210001000000000000098e01210001000000000000098f01210001000000000000099001210001000000000000099101210001000000000000099201210001000000000000099301210001000000000000099401210001000000000000099501210001000000000000099601210001000000000000099701210001000000000000099801210001000000000000099901210001000000000000099a01210001000000000000099b01210001000000000000099c01210001000000000000099d01210001000000000000099e01210001000000000000099f0121000100000000000009a00121000100000000000009a10121000100000000000009a20121000100000000000009a30121000100000000000009a40121000100000000000009a50121000100000000000009a60121000100000000000009a70121000100000000000009a80121000100000000000009a90121000100000000000009aa0121000100000000000009ab0121000100000000000009ac0121000100000000000009ad0121000100000000000009ae0121000100000000000009af0121000100000000000009b00121000100000000000009b10121000100000000000009b20121000100000000000009b30121000100000000000009b40121000100000000000009b50121000100000000000009b60121000100000000000009b70121000100000000000009b80121000100000000000009b90121000100000000000009ba0121000100000000000009bb0121000100000000000009bc0121000100000000000009bd0121000100000000000009be0121000100000000000009bf0121000100000000000009c00121000100000000000009c10121000100000000000009c20121000100000000000009c30121000100000000000009c40121000100000000000009c50121000100000000000009c60121000100000000000009c70121000100000000000009c80121000100000000000009c90121000100000000000009ca0121000100000000000009cb0121000100000000000009cc0121000100000000000009cd0121000100000000000009ce0121000100000000000009cf0121000100000000000009d00121000100000000000009d10121000100000000000009d20121000100000000000009d30121000100000000000009d40121000100000000000009d50121000100000000000009d60121000100000000000009d70121000100000000000009d80121000100000000000009d90121000100000000000009da0121000100000000000009db0121000100000000000009dc0121000100000000000009dd0121000100000000000009de0121000100000000000009df0121000100000000000009e00121000100000000000009e10121000100000000000009e20121000100000000000009e30121000100000000000009e40121000100000000000009e50121000100000000000009e60121000100000000000009e70121000100000000000009e80121000100000000000009e90121000100000000000009ea0121000100000000000009eb0121000100000000000009ec0121000100000000000009ed0121000100000000000009ee0121000100000000000009ef0121000100000000000009f00121000100000000000009f10121000100000000000009f20121000100000000000009f30121000100000000000009f40121000100000000000009f50121000100000000000009f60121000100000000000009f70121000100000000000009f80121000100000000000009f90121000100000000000009fa0121000100000000000009fb0121000100000000000009fc0121000100000000000009fd0121000100000000000009fe0121000100000000000009ff012100010000000000000a00012100010000000000000a01012100010000000000000a02012100010000000000000a03012100010000000000000a04012100010000000000000a05012100010000000000000a06012100010000000000000a07012100010000000000000a08012100010000000000000a09012100010000000000000a0a012100010000000000000a0b012100010000000000000a0c012100010000000000000a0d012100010000000000000a0e012100010000000000000a0f012100010000000000000a10012100010000000000000a11012100010000000000000a12012100010000000000000a13012100010000000000000a14012100010000000000000a15012100010000000000000a16012100010000000000000a17012100010000000000000a18012100010000000000000a19012100010000000000000a1a012100010000000000000a1b012100010000000000000a1c012100010000000000000a1d012100010000000000000a1e012100010000000000000a1f012100010000000000000a20012100010000000000000a21012100010000000000000a22012100010000000000000a23012100010000000000000a24012100010000000000000a25012100010000000000000a26012100010000000000000a27012100010000000000000a28012100010000000000000a29012100010000000000000a2a012100010000000000000a2b012100010000000000000a2c012100010000000000000a2d012100010000000000000a2e012100010000000000000a2f012100010000000000000a30012100010000000000000a31012100010000000000000a32012100010000000000000a33012100010000000000000a34012100010000000000000a35012100010000000000000a36012100010000000000000a37012100010000000000000a38012100010000000000000a39012100010000000000000a3a012100010000000000000a3b012100010000000000000a3c012100010000000000000a3d012100010000000000000a3e012100010000000000000a3f012100010000000000000a40012100010000000000000a41012100010000000000000a42012100010000000000000a43012100010000000000000a44012100010000000000000a45012100010000000000000a46012100010000000000000a47012100010000000000000a48012100010000000000000a49012100010000000000000a4a012100010000000000000a4b012100010000000000000a4c012100010000000000000a4d012100010000000000000a4e012100010000000000000a4f012100010000000000000a50012100010000000000000a51012100010000000000000a52012100010000000000000a53012100010000000000000a54012100010000000000000a55012100010000000000000a56012100010000000000000a57012100010000000000000a58012100010000000000000a59012100010000000000000a5a012100010000000000000a5b012100010000000000000a5c012100010000000000000a5d012100010000000000000a5e012100010000000000000a5f012100010000000000000a60012100010000000000000a61012100010000000000000a62012100010000000000000a63012100010000000000000a64012100010000000000000a65012100010000000000000a66012100010000000000000a67012100010000000000000a68012100010000000000000a69012100010000000000000a6a012100010000000000000a6b012100010000000000000a6c012100010000000000000a6d012100010000000000000a6e012100010000000000000a6f012100010000000000000a70012100010000000000000a71012100010000000000000a72012100010000000000000a73012100010000000000000a74012100010000000000000a75012100010000000000000a76012100010000000000000a77012100010000000000000a78012100010000000000000a79012100010000000000000a7a012100010000000000000a7b012100010000000000000a7c012100010000000000000a7d012100010000000000000a7e012100010000000000000a7f012100010000000000000a80012100010000000000000a81012100010000000000000a82012100010000000000000a83012100010000000000000a84012100010000000000000a85012100010000000000000a86012100010000000000000a87012100010000000000000a88012100010000000000000a89012100010000000000000a8a012100010000000000000a8b012100010000000000000a8c012100010000000000000a8d012100010000000000000a8e012100010000000000000a8f012100010000000000000a90012100010000000000000a91012100010000000000000a92012100010000000000000a93012100010000000000000a94012100010000000000000a95012100010000000000000a96012100010000000000000a97012100010000000000000a98012100010000000000000a99012100010000000000000a9a012100010000000000000a9b012100010000000000000a9c012100010000000000000a9d012100010000000000000a9e012100010000000000000a9f012100010000000000000aa0012100010000000000000aa1012100010000000000000aa2012100010000000000000aa3012100010000000000000aa4012100010000000000000aa5012100010000000000000aa6012100010000000000000aa7012100010000000000000aa8012100010000000000000aa9012100010000000000000aaa012100010000000000000aab012100010000000000000aac012100010000000000000aad012100010000000000000aae012100010000000000000aaf012100010000000000000ab0012100010000000000000ab1012100010000000000000ab2012100010000000000000ab3012100010000000000000ab4012100010000000000000ab5012100010000000000000ab6012100010000000000000ab7012100010000000000000ab8012100010000000000000ab9012100010000000000000aba012100010000000000000abb012100010000000000000abc012100010000000000000abd012100010000000000000abe012100010000000000000abf012100010000000000000ac0012100010000000000000ac1012100010000000000000ac2012100010000000000000ac3012100010000000000000ac4012100010000000000000ac5012100010000000000000ac6012100010000000000000ac7012100010000000000000ac8012100010000000000000ac9012100010000000000000aca012100010000000000000acb012100010000000000000acc012100010000000000000acd012100010000000000000ace012100010000000000000acf012100010000000000000ad0012100010000000000000ad1012100010000000000000ad2012100010000000000000ad3012100010000000000000ad4012100010000000000000ad5012100010000000000000ad6012100010000000000000ad7012100010000000000000ad8012100010000000000000ad9012100010000000000000ada012100010000000000000adb012100010000000000000adc012100010000000000000add012100010000000000000ade012100010000000000000adf012100010000000000000ae0012100010000000000000ae1012100010000000000000ae2012100010000000000000ae3012100010000000000000ae4012100010000000000000ae5012100010000000000000ae6012100010000000000000ae7012100010000000000000ae8012100010000000000000ae9012100010000000000000aea012100010000000000000aeb012100010000000000000aec012100010000000000000aed012100010000000000000aee012100010000000000000aef012100010000000000000af0012100010000000000000af1012100010000000000000af2012100010000000000000af3012100010000000000000af4012100010000000000000af5012100010000000000000af6012100010000000000000af7012100010000000000000af8012100010000000000000af9012100010000000000000afa012100010000000000000afb012100010000000000000afc012100010000000000000afd012100010000000000000afe012100010000000000000aff012100010000000000000b00012100010000000000000b01012100010000000000000b02012100010000000000000b03012100010000000000000b04012100010000000000000b05012100010000000000000b06012100010000000000000b07012100010000000000000b08012100010000000000000b09012100010000000000000b0a012100010000000000000b0b012100010000000000000b0c012100010000000000000b0d012100010000000000000b0e012100010000000000000b0f012100010000000000000b10012100010000000000000b11012100010000000000000b12012100010000000000000b13012100010000000000000b14012100010000000000000b15012100010000000000000b16012100010000000000000b17012100010000000000000b18012100010000000000000b19012100010000000000000b1a012100010000000000000b1b012100010000000000000b1c012100010000000000000b1d012100010000000000000b1e012100010000000000000b1f012100010000000000000b20012100010000000000000b21012100010000000000000b22012100010000000000000b23012100010000000000000b24012100010000000000000b25012100010000000000000b26012100010000000000000b27012100010000000000000b28012100010000000000000b29012100010000000000000b2a012100010000000000000b2b012100010000000000000b2c012100010000000000000b2d012100010000000000000b2e012100010000000000000b2f012100010000000000000b30012100010000000000000b31012100010000000000000b32012100010000000000000b33012100010000000000000b34012100010000000000000b35012100010000000000000b36012100010000000000000b37012100010000000000000b38012100010000000000000b39012100010000000000000b3a012100010000000000000b3b012100010000000000000b3c012100010000000000000b3d012100010000000000000b3e012100010000000000000b3f012100010000000000000b40012100010000000000000b41012100010000000000000b42012100010000000000000b43012100010000000000000b44012100010000000000000b45012100010000000000000b46012100010000000000000b47012100010000000000000b48012100010000000000000b49012100010000000000000b4a012100010000000000000b4b012100010000000000000b4c012100010000000000000b4d012100010000000000000b4e012100010000000000000b4f012100010000000000000b50012100010000000000000b51012100010000000000000b52012100010000000000000b53012100010000000000000b54012100010000000000000b55012100010000000000000b56012100010000000000000b57012100010000000000000b58012100010000000000000b59012100010000000000000b5a012100010000000000000b5b012100010000000000000b5c012100010000000000000b5d012100010000000000000b5e012100010000000000000b5f012100010000000000000b60012100010000000000000b61012100010000000000000b62012100010000000000000b63012100010000000000000b64012100010000000000000b65012100010000000000000b66012100010000000000000b67012100010000000000000b68012100010000000000000b69012100010000000000000b6a012100010000000000000b6b012100010000000000000b6c012100010000000000000b6d012100010000000000000b6e012100010000000000000b6f012100010000000000000b70012100010000000000000b71012100010000000000000b72012100010000000000000b73012100010000000000000b74012100010000000000000b75012100010000000000000b76012100010000000000000b77012100010000000000000b78012100010000000000000b79012100010000000000000b7a012100010000000000000b7b012100010000000000000b7c012100010000000000000b7d012100010000000000000b7e012100010000000000000b7f012100010000000000000b80012100010000000000000b81012100010000000000000b82012100010000000000000b83012100010000000000000b84012100010000000000000b85012100010000000000000b86012100010000000000000b87012100010000000000000b88012100010000000000000b89012100010000000000000b8a012100010000000000000b8b012100010000000000000b8c012100010000000000000b8d012100010000000000000b8e012100010000000000000b8f012100010000000000000b90012100010000000000000b91012100010000000000000b92012100010000000000000b93012100010000000000000b94012100010000000000000b95012100010000000000000b96012100010000000000000b97012100010000000000000b98012100010000000000000b99012100010000000000000b9a012100010000000000000b9b012100010000000000000b9c012100010000000000000b9d012100010000000000000b9e012100010000000000000b9f012100010000000000000ba0012100010000000000000ba1012100010000000000000ba2012100010000000000000ba3012100010000000000000ba4012100010000000000000ba5012100010000000000000ba6012100010000000000000ba7012100010000000000000ba8012100010000000000000ba9012100010000000000000baa012100010000000000000bab012100010000000000000bac012100010000000000000bad012100010000000000000bae012100010000000000000baf012100010000000000000bb0012100010000000000000bb1012100010000000000000bb2012100010000000000000bb3012100010000000000000bb4012100010000000000000bb5012100010000000000000bb6012100010000000000000bb7012100010000000000000bb8012100010000000000000bb9012100010000000000000bba012100010000000000000bbb012100010000000000000bbc012100010000000000000bbd012100010000000000000bbe012100010000000000000bbf012100010000000000000bc0012100010000000000000bc1012100010000000000000bc2012100010000000000000bc3012100010000000000000bc4012100010000000000000bc5012100010000000000000bc6012100010000000000000bc7012100010000000000000bc8012100010000000000000bc9012100010000000000000bca012100010000000000000bcb012100010000000000000bcc012100010000000000000bcd012100010000000000000bce012100010000000000000bcf012100010000000000000bd0012100010000000000000bd1012100010000000000000bd2012100010000000000000bd3012100010000000000000bd4012100010000000000000bd5012100010000000000000bd6012100010000000000000bd7012100010000000000000bd8012100010000000000000bd9012100010000000000000bda012100010000000000000bdb012100010000000000000bdc012100010000000000000bdd012100010000000000000bde012100010000000000000bdf012100010000000000000be0012100010000000000000be1012100010000000000000be2012100010000000000000be3012100010000000000000be4012100010000000000000be5012100010000000000000be6012100010000000000000be7012100010000000000000be8012100010000000000000be9012100010000000000000bea012100010000000000000beb012100010000000000000bec012100010000000000000bed012100010000000000000bee012100010000000000000bef012100010000000000000bf0012100010000000000000bf1012100010000000000000bf2012100010000000000000bf3012100010000000000000bf4012100010000000000000bf5012100010000000000000bf6012100010000000000000bf7012100010000000000000bf8012100010000000000000bf9012100010000000000000bfa012100010000000000000bfb012100010000000000000bfc012100010000000000000bfd012100010000000000000bfe012100010000000000000bff012100010000000000000c00012100010000000000000c01012100010000000000000c02012100010000000000000c03012100010000000000000c04012100010000000000000c05012100010000000000000c06012100010000000000000c07012100010000000000000c08012100010000000000000c09012100010000000000000c0a012100010000000000000c0b012100010000000000000c0c012100010000000000000c0d012100010000000000000c0e012100010000000000000c0f012100010000000000000c10012100010000000000000c11012100010000000000000c12012100010000000000000c13012100010000000000000c14012100010000000000000c15012100010000000000000c16012100010000000000000c17012100010000000000000c18012100010000000000000c19012100010000000000000c1a012100010000000000000c1b012100010000000000000c1c012100010000000000000c1d012100010000000000000c1e012100010000000000000c1f012100010000000000000c20012100010000000000000c21012100010000000000000c22012100010000000000000c23012100010000000000000c24012100010000000000000c25012100010000000000000c26012100010000000000000c27012100010000000000000c28012100010000000000000c29012100010000000000000c2a012100010000000000000c2b012100010000000000000c2c012100010000000000000c2d012100010000000000000c2e012100010000000000000c2f012100010000000000000c30012100010000000000000c31012100010000000000000c32012100010000000000000c33012100010000000000000c34012100010000000000000c35012100010000000000000c36012100010000000000000c37012100010000000000000c38012100010000000000000c39012100010000000000000c3a012100010000000000000c3b012100010000000000000c3c012100010000000000000c3d012100010000000000000c3e012100010000000000000c3f012100010000000000000c40012100010000000000000c41012100010000000000000c42012100010000000000000c43012100010000000000000c44012100010000000000000c45012100010000000000000c46012100010000000000000c47012100010000000000000c48012100010000000000000c49012100010000000000000c4a012100010000000000000c4b012100010000000000000c4c012100010000000000000c4d012100010000000000000c4e012100010000000000000c4f012100010000000000000c50012100010000000000000c51012100010000000000000c52012100010000000000000c53012100010000000000000c54012100010000000000000c55012100010000000000000c56012100010000000000000c57012100010000000000000c58012100010000000000000c59012100010000000000000c5a012100010000000000000c5b012100010000000000000c5c012100010000000000000c5d012100010000000000000c5e012100010000000000000c5f012100010000000000000c60012100010000000000000c61012100010000000000000c62012100010000000000000c63012100010000000000000c64012100010000000000000c65012100010000000000000c66012100010000000000000c67012100010000000000000c68012100010000000000000c69012100010000000000000c6a012100010000000000000c6b012100010000000000000c6c012100010000000000000c6d012100010000000000000c6e012100010000000000000c6f012100010000000000000c70012100010000000000000c71012100010000000000000c72012100010000000000000c73012100010000000000000c74012100010000000000000c75012100010000000000000c76012100010000000000000c77012100010000000000000c78012100010000000000000c79012100010000000000000c7a012100010000000000000c7b012100010000000000000c7c012100010000000000000c7d012100010000000000000c7e012100010000000000000c7f012100010000000000000c80012100010000000000000c81012100010000000000000c82012100010000000000000c83012100010000000000000c84012100010000000000000c85012100010000000000000c86012100010000000000000c87012100010000000000000c88012100010000000000000c89012100010000000000000c8a012100010000000000000c8b012100010000000000000c8c012100010000000000000c8d012100010000000000000c8e012100010000000000000c8f012100010000000000000c90012100010000000000000c91012100010000000000000c92012100010000000000000c93012100010000000000000c94012100010000000000000c95012100010000000000000c96012100010000000000000c97012100010000000000000c98012100010000000000000c99012100010000000000000c9a012100010000000000000c9b012100010000000000000c9c012100010000000000000c9d012100010000000000000c9e012100010000000000000c9f012100010000000000000ca0012100010000000000000ca1012100010000000000000ca2012100010000000000000ca3012100010000000000000ca4012100010000000000000ca5012100010000000000000ca6012100010000000000000ca7012100010000000000000ca8012100010000000000000ca9012100010000000000000caa012100010000000000000cab012100010000000000000cac012100010000000000000cad012100010000000000000cae012100010000000000000caf012100010000000000000cb0012100010000000000000cb1012100010000000000000cb2012100010000000000000cb3012100010000000000000cb4012100010000000000000cb5012100010000000000000cb6012100010000000000000cb7012100010000000000000cb8012100010000000000000cb9012100010000000000000cba012100010000000000000cbb012100010000000000000cbc012100010000000000000cbd012100010000000000000cbe012100010000000000000cbf012100010000000000000cc0012100010000000000000cc1012100010000000000000cc2012100010000000000000cc3012100010000000000000cc4012100010000000000000cc5012100010000000000000cc6012100010000000000000cc7012100010000000000000cc8012100010000000000000cc9012100010000000000000cca012100010000000000000ccb012100010000000000000ccc012100010000000000000ccd012100010000000000000cce012100010000000000000ccf012100010000000000000cd0012100010000000000000cd1012100010000000000000cd2012100010000000000000cd3012100010000000000000cd4012100010000000000000cd5012100010000000000000cd6012100010000000000000cd7012100010000000000000cd8012100010000000000000cd9012100010000000000000cda012100010000000000000cdb012100010000000000000cdc012100010000000000000cdd012100010000000000000cde012100010000000000000cdf012100010000000000000ce0012100010000000000000ce1012100010000000000000ce2012100010000000000000ce3012100010000000000000ce4012100010000000000000ce5012100010000000000000ce6012100010000000000000ce7012100010000000000000ce8012100010000000000000ce9012100010000000000000cea012100010000000000000ceb012100010000000000000cec012100010000000000000ced012100010000000000000cee012100010000000000000cef012100010000000000000cf0012100010000000000000cf1012100010000000000000cf2012100010000000000000cf3012100010000000000000cf4012100010000000000000cf5012100010000000000000cf6012100010000000000000cf7012100010000000000000cf8012100010000000000000cf9012100010000000000000cfa012100010000000000000cfb012100010000000000000cfc012100010000000000000cfd012100010000000000000cfe012100010000000000000cff012100010000000000000d00012100010000000000000d01012100010000000000000d02012100010000000000000d03012100010000000000000d04012100010000000000000d05012100010000000000000d06012100010000000000000d07012100010000000000000d08012100010000000000000d09012100010000000000000d0a012100010000000000000d0b012100010000000000000d0c012100010000000000000d0d012100010000000000000d0e012100010000000000000d0f012100010000000000000d10012100010000000000000d11012100010000000000000d12012100010000000000000d13012100010000000000000d14012100010000000000000d15012100010000000000000d16012100010000000000000d17012100010000000000000d18012100010000000000000d19012100010000000000000d1a012100010000000000000d1b012100010000000000000d1c012100010000000000000d1d012100010000000000000d1e012100010000000000000d1f012100010000000000000d20012100010000000000000d21012100010000000000000d22012100010000000000000d23012100010000000000000d24012100010000000000000d25012100010000000000000d26012100010000000000000d27012100010000000000000d28012100010000000000000d29012100010000000000000d2a012100010000000000000d2b012100010000000000000d2c012100010000000000000d2d012100010000000000000d2e012100010000000000000d2f012100010000000000000d30012100010000000000000d31012100010000000000000d32012100010000000000000d33012100010000000000000d34012100010000000000000d35012100010000000000000d36012100010000000000000d37012100010000000000000d38012100010000000000000d39012100010000000000000d3a012100010000000000000d3b012100010000000000000d3c012100010000000000000d3d012100010000000000000d3e012100010000000000000d3f012100010000000000000d40012100010000000000000d41012100010000000000000d42012100010000000000000d43012100010000000000000d44012100010000000000000d45012100010000000000000d46012100010000000000000d47012100010000000000000d48012100010000000000000d49012100010000000000000d4a012100010000000000000d4b012100010000000000000d4c012100010000000000000d4d012100010000000000000d4e012100010000000000000d4f012100010000000000000d50012100010000000000000d51012100010000000000000d52012100010000000000000d53012100010000000000000d54012100010000000000000d55012100010000000000000d56012100010000000000000d57012100010000000000000d58012100010000000000000d59012100010000000000000d5a012100010000000000000d5b012100010000000000000d5c012100010000000000000d5d012100010000000000000d5e012100010000000000000d5f012100010000000000000d60012100010000000000000d61012100010000000000000d62012100010000000000000d63012100010000000000000d64012100010000000000000d65012100010000000000000d66012100010000000000000d67012100010000000000000d68012100010000000000000d69012100010000000000000d6a012100010000000000000d6b012100010000000000000d6c012100010000000000000d6d012100010000000000000d6e012100010000000000000d6f012100010000000000000d70012100010000000000000d71012100010000000000000d72012100010000000000000d73012100010000000000000d74012100010000000000000d75012100010000000000000d76012100010000000000000d77012100010000000000000d78012100010000000000000d79012100010000000000000d7a012100010000000000000d7b012100010000000000000d7c012100010000000000000d7d012100010000000000000d7e012100010000000000000d7f012100010000000000000d80012100010000000000000d81012100010000000000000d82012100010000000000000d83012100010000000000000d84012100010000000000000d85012100010000000000000d86012100010000000000000d87012100010000000000000d88012100010000000000000d89012100010000000000000d8a012100010000000000000d8b012100010000000000000d8c012100010000000000000d8d012100010000000000000d8e012100010000000000000d8f012100010000000000000d90012100010000000000000d91012100010000000000000d92012100010000000000000d93012100010000000000000d94012100010000000000000d95012100010000000000000d96012100010000000000000d97012100010000000000000d98012100010000000000000d99012100010000000000000d9a012100010000000000000d9b012100010000000000000d9c012100010000000000000d9d012100010000000000000d9e012100010000000000000d9f012100010000000000000da0012100010000000000000da1012100010000000000000da2012100010000000000000da3012100010000000000000da4012100010000000000000da5012100010000000000000da6012100010000000000000da7012100010000000000000da8012100010000000000000da9012100010000000000000daa012100010000000000000dab012100010000000000000dac012100010000000000000dad012100010000000000000dae012100010000000000000daf012100010000000000000db0012100010000000000000db1012100010000000000000db2012100010000000000000db3012100010000000000000db4012100010000000000000db5012100010000000000000db6012100010000000000000db7012100010000000000000db8012100010000000000000db9012100010000000000000dba012100010000000000000dbb012100010000000000000dbc012100010000000000000dbd012100010000000000000dbe012100010000000000000dbf012100010000000000000dc0012100010000000000000dc1012100010000000000000dc2012100010000000000000dc3012100010000000000000dc4012100010000000000000dc5012100010000000000000dc6012100010000000000000dc7012100010000000000000dc8012100010000000000000dc9012100010000000000000dca012100010000000000000dcb012100010000000000000dcc012100010000000000000dcd012100010000000000000dce012100010000000000000dcf012100010000000000000dd0012100010000000000000dd1012100010000000000000dd2012100010000000000000dd3012100010000000000000dd4012100010000000000000dd5012100010000000000000dd6012100010000000000000dd7012100010000000000000dd8012100010000000000000dd9012100010000000000000dda012100010000000000000ddb012100010000000000000ddc012100010000000000000ddd012100010000000000000dde012100010000000000000ddf012100010000000000000de0012100010000000000000de1012100010000000000000de2012100010000000000000de3012100010000000000000de4012100010000000000000de5012100010000000000000de6012100010000000000000de7012100010000000000000de8012100010000000000000de9012100010000000000000dea012100010000000000000deb012100010000000000000dec012100010000000000000ded012100010000000000000dee012100010000000000000def012100010000000000000df0012100010000000000000df1012100010000000000000df2012100010000000000000df3012100010000000000000df4012100010000000000000df5012100010000000000000df6012100010000000000000df7012100010000000000000df8012100010000000000000df9012100010000000000000dfa012100010000000000000dfb012100010000000000000dfc012100010000000000000dfd012100010000000000000dfe012100010000000000000dff012100010000000000000e00012100010000000000000e01012100010000000000000e02012100010000000000000e03012100010000000000000e04012100010000000000000e05012100010000000000000e06012100010000000000000e07012100010000000000000e08012100010000000000000e09012100010000000000000e0a012100010000000000000e0b012100010000000000000e0c012100010000000000000e0d012100010000000000000e0e012100010000000000000e0f012100010000000000000e10012100010000000000000e11012100010000000000000e12012100010000000000000e13012100010000000000000e14012100010000000000000e15012100010000000000000e16012100010000000000000e17012100010000000000000e18012100010000000000000e19012100010000000000000e1a012100010000000000000e1b012100010000000000000e1c012100010000000000000e1d012100010000000000000e1e012100010000000000000e1f012100010000000000000e20012100010000000000000e21012100010000000000000e22012100010000000000000e23012100010000000000000e24012100010000000000000e25012100010000000000000e26012100010000000000000e27012100010000000000000e28012100010000000000000e29012100010000000000000e2a012100010000000000000e2b012100010000000000000e2c012100010000000000000e2d012100010000000000000e2e012100010000000000000e2f012100010000000000000e30012100010000000000000e31012100010000000000000e32012100010000000000000e33012100010000000000000e34012100010000000000000e35012100010000000000000e36012100010000000000000e37012100010000000000000e38012100010000000000000e39012100010000000000000e3a012100010000000000000e3b012100010000000000000e3c012100010000000000000e3d012100010000000000000e3e012100010000000000000e3f012100010000000000000e40012100010000000000000e41012100010000000000000e42012100010000000000000e43012100010000000000000e44012100010000000000000e45012100010000000000000e46012100010000000000000e47012100010000000000000e48012100010000000000000e49012100010000000000000e4a012100010000000000000e4b012100010000000000000e4c012100010000000000000e4d012100010000000000000e4e012100010000000000000e4f012100010000000000000e50012100010000000000000e51012100010000000000000e52012100010000000000000e53012100010000000000000e54012100010000000000000e55012100010000000000000e56012100010000000000000e57012100010000000000000e58012100010000000000000e59012100010000000000000e5a012100010000000000000e5b012100010000000000000e5c012100010000000000000e5d012100010000000000000e5e012100010000000000000e5f012100010000000000000e60012100010000000000000e61012100010000000000000e62012100010000000000000e63012100010000000000000e64012100010000000000000e65012100010000000000000e66012100010000000000000e67012100010000000000000e68012100010000000000000e69012100010000000000000e6a012100010000000000000e6b012100010000000000000e6c012100010000000000000e6d012100010000000000000e6e012100010000000000000e6f012100010000000000000e70012100010000000000000e71012100010000000000000e72012100010000000000000e73012100010000000000000e74012100010000000000000e75012100010000000000000e76012100010000000000000e77012100010000000000000e78012100010000000000000e79012100010000000000000e7a012100010000000000000e7b012100010000000000000e7c012100010000000000000e7d012100010000000000000e7e012100010000000000000e7f012100010000000000000e80012100010000000000000e81012100010000000000000e82012100010000000000000e83012100010000000000000e84012100010000000000000e85012100010000000000000e86012100010000000000000e87012100010000000000000e88012100010000000000000e89012100010000000000000e8a012100010000000000000e8b012100010000000000000e8c012100010000000000000e8d012100010000000000000e8e012100010000000000000e8f012100010000000000000e90012100010000000000000e91012100010000000000000e92012100010000000000000e93012100010000000000000e94012100010000000000000e95012100010000000000000e96012100010000000000000e97012100010000000000000e98012100010000000000000e99012100010000000000000e9a012100010000000000000e9b012100010000000000000e9c012100010000000000000e9d012100010000000000000e9e012100010000000000000e9f012100010000000000000ea0012100010000000000000ea1012100010000000000000ea2012100010000000000000ea3012100010000000000000ea4012100010000000000000ea5012100010000000000000ea6012100010000000000000ea7012100010000000000000ea8012100010000000000000ea9012100010000000000000eaa012100010000000000000eab012100010000000000000eac012100010000000000000ead012100010000000000000eae012100010000000000000eaf012100010000000000000eb0012100010000000000000eb1012100010000000000000eb2012100010000000000000eb3012100010000000000000eb4012100010000000000000eb5012100010000000000000eb6012100010000000000000eb7012100010000000000000eb8012100010000000000000eb9012100010000000000000eba012100010000000000000ebb012100010000000000000ebc012100010000000000000ebd012100010000000000000ebe012100010000000000000ebf012100010000000000000ec0012100010000000000000ec1012100010000000000000ec2012100010000000000000ec3012100010000000000000ec4012100010000000000000ec5012100010000000000000ec6012100010000000000000ec7012100010000000000000ec8012100010000000000000ec9012100010000000000000eca012100010000000000000ecb012100010000000000000ecc012100010000000000000ecd012100010000000000000ece012100010000000000000ecf012100010000000000000ed0012100010000000000000ed1012100010000000000000ed2012100010000000000000ed3012100010000000000000ed4012100010000000000000ed5012100010000000000000ed6012100010000000000000ed7012100010000000000000ed8012100010000000000000ed9012100010000000000000eda012100010000000000000edb012100010000000000000edc012100010000000000000edd012100010000000000000ede012100010000000000000edf012100010000000000000ee0012100010000000000000ee1012100010000000000000ee2012100010000000000000ee3012100010000000000000ee4012100010000000000000ee5012100010000000000000ee6012100010000000000000ee7012100010000000000000ee8012100010000000000000ee9012100010000000000000eea012100010000000000000eeb012100010000000000000eec012100010000000000000eed012100010000000000000eee012100010000000000000eef012100010000000000000ef0012100010000000000000ef1012100010000000000000ef2012100010000000000000ef3012100010000000000000ef4012100010000000000000ef5012100010000000000000ef6012100010000000000000ef7012100010000000000000ef8012100010000000000000ef9012100010000000000000efa012100010000000000000efb012100010000000000000efc012100010000000000000efd012100010000000000000efe012100010000000000000eff012100010000000000000f00012100010000000000000f01012100010000000000000f02012100010000000000000f03012100010000000000000f04012100010000000000000f05012100010000000000000f06012100010000000000000f07012100010000000000000f08012100010000000000000f09012100010000000000000f0a012100010000000000000f0b012100010000000000000f0c012100010000000000000f0d012100010000000000000f0e012100010000000000000f0f012100010000000000000f10012100010000000000000f11012100010000000000000f12012100010000000000000f13012100010000000000000f14012100010000000000000f15012100010000000000000f16012100010000000000000f17012100010000000000000f18012100010000000000000f19012100010000000000000f1a012100010000000000000f1b012100010000000000000f1c012100010000000000000f1d012100010000000000000f1e012100010000000000000f1f012100010000000000000f20012100010000000000000f21012100010000000000000f22012100010000000000000f23012100010000000000000f24012100010000000000000f25012100010000000000000f26012100010000000000000f27012100010000000000000f28012100010000000000000f29012100010000000000000f2a012100010000000000000f2b012100010000000000000f2c012100010000000000000f2d012100010000000000000f2e012100010000000000000f2f012100010000000000000f30012100010000000000000f31012100010000000000000f32012100010000000000000f33012100010000000000000f34012100010000000000000f35012100010000000000000f36012100010000000000000f37012100010000000000000f38012100010000000000000f39012100010000000000000f3a012100010000000000000f3b012100010000000000000f3c012100010000000000000f3d012100010000000000000f3e012100010000000000000f3f012100010000000000000f40012100010000000000000f41012100010000000000000f42012100010000000000000f43012100010000000000000f44012100010000000000000f45012100010000000000000f46012100010000000000000f47012100010000000000000f48012100010000000000000f49012100010000000000000f4a012100010000000000000f4b012100010000000000000f4c012100010000000000000f4d012100010000000000000f4e012100010000000000000f4f012100010000000000000f50012100010000000000000f51012100010000000000000f52012100010000000000000f53012100010000000000000f54012100010000000000000f55012100010000000000000f56012100010000000000000f57012100010000000000000f58012100010000000000000f59012100010000000000000f5a012100010000000000000f5b012100010000000000000f5c012100010000000000000f5d012100010000000000000f5e012100010000000000000f5f012100010000000000000f60012100010000000000000f61012100010000000000000f62012100010000000000000f63012100010000000000000f64012100010000000000000f65012100010000000000000f66012100010000000000000f67012100010000000000000f68012100010000000000000f69012100010000000000000f6a012100010000000000000f6b012100010000000000000f6c012100010000000000000f6d012100010000000000000f6e012100010000000000000f6f012100010000000000000f70012100010000000000000f71012100010000000000000f72012100010000000000000f73012100010000000000000f74012100010000000000000f75012100010000000000000f76012100010000000000000f77012100010000000000000f78012100010000000000000f79012100010000000000000f7a012100010000000000000f7b012100010000000000000f7c012100010000000000000f7d012100010000000000000f7e012100010000000000000f7f012100010000000000000f80012100010000000000000f81012100010000000000000f82012100010000000000000f83012100010000000000000f84012100010000000000000f85012100010000000000000f86012100010000000000000f87012100010000000000000f88012100010000000000000f89012100010000000000000f8a012100010000000000000f8b012100010000000000000f8c012100010000000000000f8d012100010000000000000f8e012100010000000000000f8f012100010000000000000f90012100010000000000000f91012100010000000000000f92012100010000000000000f93012100010000000000000f94012100010000000000000f95012100010000000000000f96012100010000000000000f97012100010000000000000f98012100010000000000000f99012100010000000000000f9a012100010000000000000f9b012100010000000000000f9c012100010000000000000f9d012100010000000000000f9e012100010000000000000f9f012100010000000000000fa0012100010000000000000fa1012100010000000000000fa2012100010000000000000fa3012100010000000000000fa4012100010000000000000fa5012100010000000000000fa6012100010000000000000fa7012100010000000000000fa8012100010000000000000fa9012100010000000000000faa012100010000000000000fab012100010000000000000fac012100010000000000000fad012100010000000000000fae012100010000000000000faf012100010000000000000fb0012100010000000000000fb1012100010000000000000fb2012100010000000000000fb3012100010000000000000fb4012100010000000000000fb5012100010000000000000fb6012100010000000000000fb7012100010000000000000fb8012100010000000000000fb9012100010000000000000fba012100010000000000000fbb012100010000000000000fbc012100010000000000000fbd012100010000000000000fbe012100010000000000000fbf012100010000000000000fc0012100010000000000000fc1012100010000000000000fc2012100010000000000000fc3012100010000000000000fc4012100010000000000000fc5012100010000000000000fc6012100010000000000000fc7012100010000000000000fc8012100010000000000000fc9012100010000000000000fca012100010000000000000fcb012100010000000000000fcc012100010000000000000fcd012100010000000000000fce012100010000000000000fcf012100010000000000000fd0012100010000000000000fd1012100010000000000000fd2012100010000000000000fd3012100010000000000000fd4012100010000000000000fd5012100010000000000000fd6012100010000000000000fd7012100010000000000000fd8012100010000000000000fd9012100010000000000000fda012100010000000000000fdb012100010000000000000fdc012100010000000000000fdd012100010000000000000fde012100010000000000000fdf012100010000000000000fe0012100010000000000000fe1012100010000000000000fe2012100010000000000000fe3012100010000000000000fe4012100010000000000000fe5012100010000000000000fe6012100010000000000000fe7012100010000000000000fe8012100010000000000000fe9012100010000000000000fea012100010000000000000feb012100010000000000000fec012100010000000000000fed012100010000000000000fee012100010000000000000fef012100010000000000000ff0012100010000000000000ff1012100010000000000000ff2012100010000000000000ff3012100010000000000000ff4012100010000000000000ff5012100010000000000000ff6012100010000000000000ff7012100010000000000000ff8012100010000000000000ff9012100010000000000000ffa012100010000000000000ffb012100010000000000000ffc012100010000000000000ffd012100010000000000000ffe012100010000000000000fff01210001000000000000100001210001000000000000100101210001000000000000100201210001000000000000100301210001000000000000100401210001000000000000100501210001000000000000100601210001000000000000100701210001000000000000100801210001000000000000100901210001000000000000100a01210001000000000000100b01210001000000000000100c01210001000000000000100d01210001000000000000100e01210001000000000000100f01210001000000000000101001210001000000000000101101210001000000000000101201210001000000000000101301210001000000000000101401210001000000000000101501210001000000000000101601210001000000000000101701210001000000000000101801210001000000000000101901210001000000000000101a01210001000000000000101b01210001000000000000101c01210001000000000000101d01210001000000000000101e01210001000000000000101f01210001000000000000102001210001000000000000102101210001000000000000102201210001000000000000102301210001000000000000102401210001000000000000102501210001000000000000102601210001000000000000102701210001000000000000102801210001000000000000102901210001000000000000102a01210001000000000000102b01210001000000000000102c01210001000000000000102d01210001000000000000102e01210001000000000000102f01210001000000000000103001210001000000000000103101210001000000000000103201210001000000000000103301210001000000000000103401210001000000000000103501210001000000000000103601210001000000000000103701210001000000000000103801210001000000000000103901210001000000000000103a01210001000000000000103b01210001000000000000103c01210001000000000000103d01210001000000000000103e01210001000000000000103f01210001000000000000104001210001000000000000104101210001000000000000104201210001000000000000104301210001000000000000104401210001000000000000104501210001000000000000104601210001000000000000104701210001000000000000104801210001000000000000104901210001000000000000104a01210001000000000000104b01210001000000000000104c01210001000000000000104d01210001000000000000104e01210001000000000000104f01210001000000000000105001210001000000000000105101210001000000000000105201210001000000000000105301210001000000000000105401210001000000000000105501210001000000000000105601210001000000000000105701210001000000000000105801210001000000000000105901210001000000000000105a01210001000000000000105b01210001000000000000105c01210001000000000000105d01210001000000000000105e01210001000000000000105f01210001000000000000106001210001000000000000106101210001000000000000106201210001000000000000106301210001000000000000106401210001000000000000106501210001000000000000106601210001000000000000106701210001000000000000106801210001000000000000106901210001000000000000106a01210001000000000000106b01210001000000000000106c01210001000000000000106d01210001000000000000106e01210001000000000000106f01210001000000000000107001210001000000000000107101210001000000000000107201210001000000000000107301210001000000000000107401210001000000000000107501210001000000000000107601210001000000000000107701210001000000000000107801210001000000000000107901210001000000000000107a01210001000000000000107b01210001000000000000107c01210001000000000000107d01210001000000000000107e01210001000000000000107f01210001000000000000108001210001000000000000108101210001000000000000108201210001000000000000108301210001000000000000108401210001000000000000108501210001000000000000108601210001000000000000108701210001000000000000108801210001000000000000108901210001000000000000108a01210001000000000000108b01210001000000000000108c01210001000000000000108d01210001000000000000108e01210001000000000000108f01210001000000000000109001210001000000000000109101210001000000000000109201210001000000000000109301210001000000000000109401210001000000000000109501210001000000000000109601210001000000000000109701210001000000000000109801210001000000000000109901210001000000000000109a01210001000000000000109b01210001000000000000109c01210001000000000000109d01210001000000000000109e01210001000000000000109f0121000100000000000010a00121000100000000000010a10121000100000000000010a20121000100000000000010a30121000100000000000010a40121000100000000000010a50121000100000000000010a60121000100000000000010a70121000100000000000010a80121000100000000000010a90121000100000000000010aa0121000100000000000010ab0121000100000000000010ac0121000100000000000010ad0121000100000000000010ae0121000100000000000010af0121000100000000000010b00121000100000000000010b10121000100000000000010b20121000100000000000010b30121000100000000000010b40121000100000000000010b50121000100000000000010b60121000100000000000010b70121000100000000000010b80121000100000000000010b90121000100000000000010ba0121000100000000000010bb0121000100000000000010bc0121000100000000000010bd0121000100000000000010be0121000100000000000010bf0121000100000000000010c00121000100000000000010c10121000100000000000010c20121000100000000000010c30121000100000000000010c40121000100000000000010c50121000100000000000010c60121000100000000000010c70121000100000000000010c80121000100000000000010c90121000100000000000010ca0121000100000000000010cb0121000100000000000010cc0121000100000000000010cd0121000100000000000010ce0121000100000000000010cf0121000100000000000010d00121000100000000000010d10121000100000000000010d20121000100000000000010d30121000100000000000010d40121000100000000000010d50121000100000000000010d60121000100000000000010d70121000100000000000010d80121000100000000000010d90121000100000000000010da0121000100000000000010db0121000100000000000010dc0121000100000000000010dd0121000100000000000010de0121000100000000000010df0121000100000000000010e00121000100000000000010e10121000100000000000010e20121000100000000000010e30121000100000000000010e40121000100000000000010e50121000100000000000010e60121000100000000000010e70121000100000000000010e80121000100000000000010e90121000100000000000010ea0121000100000000000010eb0121000100000000000010ec0121000100000000000010ed0121000100000000000010ee0121000100000000000010ef0121000100000000000010f00121000100000000000010f10121000100000000000010f20121000100000000000010f30121000100000000000010f40121000100000000000010f50121000100000000000010f60121000100000000000010f70121000100000000000010f80121000100000000000010f90121000100000000000010fa0121000100000000000010fb0121000100000000000010fc0121000100000000000010fd0121000100000000000010fe0121000100000000000010ff01210001000000000000110001210001000000000000110101210001000000000000110201210001000000000000110301210001000000000000110401210001000000000000110501210001000000000000110601210001000000000000110701210001000000000000110801210001000000000000110901210001000000000000110a01210001000000000000110b01210001000000000000110c01210001000000000000110d01210001000000000000110e01210001000000000000110f01210001000000000000111001210001000000000000111101210001000000000000111201210001000000000000111301210001000000000000111401210001000000000000111501210001000000000000111601210001000000000000111701210001000000000000111801210001000000000000111901210001000000000000111a01210001000000000000111b01210001000000000000111c01210001000000000000111d01210001000000000000111e01210001000000000000111f01210001000000000000112001210001000000000000112101210001000000000000112201210001000000000000112301210001000000000000112401210001000000000000112501210001000000000000112601210001000000000000112701210001000000000000112801210001000000000000112901210001000000000000112a01210001000000000000112b01210001000000000000112c01210001000000000000112d01210001000000000000112e01210001000000000000112f01210001000000000000113001210001000000000000113101210001000000000000113201210001000000000000113301210001000000000000113401210001000000000000113501210001000000000000113601210001000000000000113701210001000000000000113801210001000000000000113901210001000000000000113a01210001000000000000113b01210001000000000000113c01210001000000000000113d01210001000000000000113e01210001000000000000113f01210001000000000000114001210001000000000000114101210001000000000000114201210001000000000000114301210001000000000000114401210001000000000000114501210001000000000000114601210001000000000000114701210001000000000000114801210001000000000000114901210001000000000000114a01210001000000000000114b01210001000000000000114c01210001000000000000114d01210001000000000000114e01210001000000000000114f01210001000000000000115001210001000000000000115101210001000000000000115201210001000000000000115301210001000000000000115401210001000000000000115501210001000000000000115601210001000000000000115701210001000000000000115801210001000000000000115901210001000000000000115a01210001000000000000115b01210001000000000000115c01210001000000000000115d01210001000000000000115e01210001000000000000115f01210001000000000000116001210001000000000000116101210001000000000000116201210001000000000000116301210001000000000000116401210001000000000000116501210001000000000000116601210001000000000000116701210001000000000000116801210001000000000000116901210001000000000000116a01210001000000000000116b01210001000000000000116c01210001000000000000116d01210001000000000000116e01210001000000000000116f01210001000000000000117001210001000000000000117101210001000000000000117201210001000000000000117301210001000000000000117401210001000000000000117501210001000000000000117601210001000000000000117701210001000000000000117801210001000000000000117901210001000000000000117a01210001000000000000117b01210001000000000000117c01210001000000000000117d01210001000000000000117e01210001000000000000117f01210001000000000000118001210001000000000000118101210001000000000000118201210001000000000000118301210001000000000000118401210001000000000000118501210001000000000000118601210001000000000000118701210001000000000000118801210001000000000000118901210001000000000000118a01210001000000000000118b01210001000000000000118c01210001000000000000118d01210001000000000000118e01210001000000000000118f01210001000000000000119001210001000000000000119101210001000000000000119201210001000000000000119301210001000000000000119401210001000000000000119501210001000000000000119601210001000000000000119701210001000000000000119801210001000000000000119901210001000000000000119a01210001000000000000119b01210001000000000000119c01210001000000000000119d01210001000000000000119e01210001000000000000119f0121000100000000000011a00121000100000000000011a10121000100000000000011a20121000100000000000011a30121000100000000000011a40121000100000000000011a50121000100000000000011a60121000100000000000011a70121000100000000000011a80121000100000000000011a90121000100000000000011aa0121000100000000000011ab0121000100000000000011ac0121000100000000000011ad0121000100000000000011ae0121000100000000000011af0121000100000000000011b00121000100000000000011b10121000100000000000011b20121000100000000000011b30121000100000000000011b40121000100000000000011b50121000100000000000011b60121000100000000000011b70121000100000000000011b80121000100000000000011b90121000100000000000011ba0121000100000000000011bb0121000100000000000011bc0121000100000000000011bd0121000100000000000011be0121000100000000000011bf0121000100000000000011c00121000100000000000011c10121000100000000000011c20121000100000000000011c30121000100000000000011c40121000100000000000011c50121000100000000000011c60121000100000000000011c70121000100000000000011c80121000100000000000011c90121000100000000000011ca0121000100000000000011cb0121000100000000000011cc0121000100000000000011cd0121000100000000000011ce0121000100000000000011cf0121000100000000000011d00121000100000000000011d10121000100000000000011d20121000100000000000011d30121000100000000000011d40121000100000000000011d50121000100000000000011d60121000100000000000011d70121000100000000000011d80121000100000000000011d90121000100000000000011da0121000100000000000011db0121000100000000000011dc0121000100000000000011dd0121000100000000000011de0121000100000000000011df0121000100000000000011e00121000100000000000011e10121000100000000000011e20121000100000000000011e30121000100000000000011e40121000100000000000011e50121000100000000000011e60121000100000000000011e70121000100000000000011e80121000100000000000011e90121000100000000000011ea0121000100000000000011eb0121000100000000000011ec0121000100000000000011ed0121000100000000000011ee0121000100000000000011ef0121000100000000000011f00121000100000000000011f10121000100000000000011f20121000100000000000011f30121000100000000000011f40121000100000000000011f50121000100000000000011f60121000100000000000011f70121000100000000000011f80121000100000000000011f90121000100000000000011fa0121000100000000000011fb0121000100000000000011fc0121000100000000000011fd0121000100000000000011fe0121000100000000000011ff01210001000000000000120001210001000000000000120101210001000000000000120201210001000000000000120301210001000000000000120401210001000000000000120501210001000000000000120601210001000000000000120701210001000000000000120801210001000000000000120901210001000000000000120a01210001000000000000120b01210001000000000000120c01210001000000000000120d01210001000000000000120e01210001000000000000120f01210001000000000000121001210001000000000000121101210001000000000000121201210001000000000000121301210001000000000000121401210001000000000000121501210001000000000000121601210001000000000000121701210001000000000000121801210001000000000000121901210001000000000000121a01210001000000000000121b01210001000000000000121c01210001000000000000121d01210001000000000000121e01210001000000000000121f01210001000000000000122001210001000000000000122101210001000000000000122201210001000000000000122301210001000000000000122401210001000000000000122501210001000000000000122601210001000000000000122701210001000000000000122801210001000000000000122901210001000000000000122a01210001000000000000122b01210001000000000000122c01210001000000000000122d01210001000000000000122e01210001000000000000122f01210001000000000000123001210001000000000000123101210001000000000000123201210001000000000000123301210001000000000000123401210001000000000000123501210001000000000000123601210001000000000000123701210001000000000000123801210001000000000000123901210001000000000000123a01210001000000000000123b01210001000000000000123c01210001000000000000123d01210001000000000000123e01210001000000000000123f01210001000000000000124001210001000000000000124101210001000000000000124201210001000000000000124301210001000000000000124401210001000000000000124501210001000000000000124601210001000000000000124701210001000000000000124801210001000000000000124901210001000000000000124a01210001000000000000124b01210001000000000000124c01210001000000000000124d01210001000000000000124e01210001000000000000124f01210001000000000000125001210001000000000000125101210001000000000000125201210001000000000000125301210001000000000000125401210001000000000000125501210001000000000000125601210001000000000000125701210001000000000000125801210001000000000000125901210001000000000000125a01210001000000000000125b01210001000000000000125c01210001000000000000125d01210001000000000000125e01210001000000000000125f01210001000000000000126001210001000000000000126101210001000000000000126201210001000000000000126301210001000000000000126401210001000000000000126501210001000000000000126601210001000000000000126701210001000000000000126801210001000000000000126901210001000000000000126a01210001000000000000126b01210001000000000000126c01210001000000000000126d01210001000000000000126e01210001000000000000126f01210001000000000000127001210001000000000000127101210001000000000000127201210001000000000000127301210001000000000000127401210001000000000000127501210001000000000000127601210001000000000000127701210001000000000000127801210001000000000000127901210001000000000000127a01210001000000000000127b01210001000000000000127c01210001000000000000127d01210001000000000000127e01210001000000000000127f01210001000000000000128001210001000000000000128101210001000000000000128201210001000000000000128301210001000000000000128401210001000000000000128501210001000000000000128601210001000000000000128701210001000000000000128801210001000000000000128901210001000000000000128a01210001000000000000128b01210001000000000000128c01210001000000000000128d01210001000000000000128e01210001000000000000128f01210001000000000000129001210001000000000000129101210001000000000000129201210001000000000000129301210001000000000000129401210001000000000000129501210001000000000000129601210001000000000000129701210001000000000000129801210001000000000000129901210001000000000000129a01210001000000000000129b01210001000000000000129c01210001000000000000129d01210001000000000000129e01210001000000000000129f0121000100000000000012a00121000100000000000012a10121000100000000000012a20121000100000000000012a30121000100000000000012a40121000100000000000012a50121000100000000000012a60121000100000000000012a70121000100000000000012a80121000100000000000012a90121000100000000000012aa0121000100000000000012ab0121000100000000000012ac0121000100000000000012ad0121000100000000000012ae0121000100000000000012af0121000100000000000012b00121000100000000000012b10121000100000000000012b20121000100000000000012b30121000100000000000012b40121000100000000000012b50121000100000000000012b60121000100000000000012b70121000100000000000012b80121000100000000000012b90121000100000000000012ba0121000100000000000012bb0121000100000000000012bc0121000100000000000012bd0121000100000000000012be0121000100000000000012bf0121000100000000000012c00121000100000000000012c10121000100000000000012c20121000100000000000012c30121000100000000000012c40121000100000000000012c50121000100000000000012c60121000100000000000012c70121000100000000000012c80121000100000000000012c90121000100000000000012ca0121000100000000000012cb0121000100000000000012cc0121000100000000000012cd0121000100000000000012ce0121000100000000000012cf0121000100000000000012d00121000100000000000012d10121000100000000000012d20121000100000000000012d30121000100000000000012d40121000100000000000012d50121000100000000000012d60121000100000000000012d70121000100000000000012d80121000100000000000012d90121000100000000000012da0121000100000000000012db0121000100000000000012dc0121000100000000000012dd0121000100000000000012de0121000100000000000012df0121000100000000000012e00121000100000000000012e10121000100000000000012e20121000100000000000012e30121000100000000000012e40121000100000000000012e50121000100000000000012e60121000100000000000012e70121000100000000000012e80121000100000000000012e90121000100000000000012ea0121000100000000000012eb0121000100000000000012ec0121000100000000000012ed0121000100000000000012ee0121000100000000000012ef0121000100000000000012f00121000100000000000012f10121000100000000000012f20121000100000000000012f30121000100000000000012f40121000100000000000012f50121000100000000000012f60121000100000000000012f70121000100000000000012f80121000100000000000012f90121000100000000000012fa0121000100000000000012fb0121000100000000000012fc0121000100000000000012fd0121000100000000000012fe0121000100000000000012ff01210001000000000000130001210001000000000000130101210001000000000000130201210001000000000000130301210001000000000000130401210001000000000000130501210001000000000000130601210001000000000000130701210001000000000000130801210001000000000000130901210001000000000000130a01210001000000000000130b01210001000000000000130c01210001000000000000130d01210001000000000000130e01210001000000000000130f01210001000000000000131001210001000000000000131101210001000000000000131201210001000000000000131301210001000000000000131401210001000000000000131501210001000000000000131601210001000000000000131701210001000000000000131801210001000000000000131901210001000000000000131a01210001000000000000131b01210001000000000000131c01210001000000000000131d01210001000000000000131e01210001000000000000131f01210001000000000000132001210001000000000000132101210001000000000000132201210001000000000000132301210001000000000000132401210001000000000000132501210001000000000000132601210001000000000000132701210001000000000000132801210001000000000000132901210001000000000000132a01210001000000000000132b01210001000000000000132c01210001000000000000132d01210001000000000000132e01210001000000000000132f01210001000000000000133001210001000000000000133101210001000000000000133201210001000000000000133301210001000000000000133401210001000000000000133501210001000000000000133601210001000000000000133701210001000000000000133801210001000000000000133901210001000000000000133a01210001000000000000133b01210001000000000000133c01210001000000000000133d01210001000000000000133e01210001000000000000133f01210001000000000000134001210001000000000000134101210001000000000000134201210001000000000000134301210001000000000000134401210001000000000000134501210001000000000000134601210001000000000000134701210001000000000000134801210001000000000000134901210001000000000000134a01210001000000000000134b01210001000000000000134c01210001000000000000134d01210001000000000000134e01210001000000000000134f01210001000000000000135001210001000000000000135101210001000000000000135201210001000000000000135301210001000000000000135401210001000000000000135501210001000000000000135601210001000000000000135701210001000000000000135801210001000000000000135901210001000000000000135a01210001000000000000135b01210001000000000000135c01210001000000000000135d01210001000000000000135e01210001000000000000135f01210001000000000000136001210001000000000000136101210001000000000000136201210001000000000000136301210001000000000000136401210001000000000000136501210001000000000000136601210001000000000000136701210001000000000000136801210001000000000000136901210001000000000000136a01210001000000000000136b01210001000000000000136c01210001000000000000136d01210001000000000000136e01210001000000000000136f01210001000000000000137001210001000000000000137101210001000000000000137201210001000000000000137301210001000000000000137401210001000000000000137501210001000000000000137601210001000000000000137701210001000000000000137801210001000000000000137901210001000000000000137a01210001000000000000137b01210001000000000000137c01210001000000000000137d01210001000000000000137e01210001000000000000137f01210001000000000000138001210001000000000000138101210001000000000000138201210001000000000000138301210001000000000000138401210001000000000000138501210001000000000000138601210001000000000000138701210001000000000000138801210001000000000000138901210001000000000000138a01210001000000000000138b01210001000000000000138c01210001000000000000138d01210001000000000000138e01210001000000000000138f01210001000000000000139001210001000000000000139101210001000000000000139201210001000000000000139301210001000000000000139401210001000000000000139501210001000000000000139601210001000000000000139701210001000000000000139801210001000000000000139901210001000000000000139a01210001000000000000139b01210001000000000000139c01210001000000000000139d01210001000000000000139e01210001000000000000139f0121000100000000000013a00121000100000000000013a10121000100000000000013a20121000100000000000013a30121000100000000000013a40121000100000000000013a50121000100000000000013a60121000100000000000013a70121000100000000000013a80121000100000000000013a90121000100000000000013aa0121000100000000000013ab0121000100000000000013ac0121000100000000000013ad0121000100000000000013ae0121000100000000000013af0121000100000000000013b00121000100000000000013b10121000100000000000013b20121000100000000000013b30121000100000000000013b40121000100000000000013b50121000100000000000013b60121000100000000000013b70121000100000000000013b80121000100000000000013b90121000100000000000013ba0121000100000000000013bb0121000100000000000013bc0121000100000000000013bd0121000100000000000013be0121000100000000000013bf0121000100000000000013c00121000100000000000013c10121000100000000000013c20121000100000000000013c30121000100000000000013c40121000100000000000013c50121000100000000000013c60121000100000000000013c70121000100000000000013c80121000100000000000013c90121000100000000000013ca0121000100000000000013cb0121000100000000000013cc0121000100000000000013cd0121000100000000000013ce0121000100000000000013cf0121000100000000000013d00121000100000000000013d10121000100000000000013d20121000100000000000013d30121000100000000000013d40121000100000000000013d50121000100000000000013d60121000100000000000013d70121000100000000000013d80121000100000000000013d90121000100000000000013da0121000100000000000013db0121000100000000000013dc0121000100000000000013dd0121000100000000000013de0121000100000000000013df0121000100000000000013e00121000100000000000013e10121000100000000000013e20121000100000000000013e30121000100000000000013e40121000100000000000013e50121000100000000000013e60121000100000000000013e70121000100000000000013e80121000100000000000013e90121000100000000000013ea0121000100000000000013eb0121000100000000000013ec0121000100000000000013ed0121000100000000000013ee0121000100000000000013ef0121000100000000000013f00121000100000000000013f10121000100000000000013f20121000100000000000013f30121000100000000000013f40121000100000000000013f50121000100000000000013f60121000100000000000013f70121000100000000000013f80121000100000000000013f90121000100000000000013fa0121000100000000000013fb0121000100000000000013fc0121000100000000000013fd0121000100000000000013fe0121000100000000000013ff01210001000000000000140001210001000000000000140101210001000000000000140201210001000000000000140301210001000000000000140401210001000000000000140501210001000000000000140601210001000000000000140701210001000000000000140801210001000000000000140901210001000000000000140a01210001000000000000140b01210001000000000000140c01210001000000000000140d01210001000000000000140e01210001000000000000140f01210001000000000000141001210001000000000000141101210001000000000000141201210001000000000000141301210001000000000000141401210001000000000000141501210001000000000000141601210001000000000000141701210001000000000000141801210001000000000000141901210001000000000000141a01210001000000000000141b01210001000000000000141c01210001000000000000141d01210001000000000000141e01210001000000000000141f01210001000000000000142001210001000000000000142101210001000000000000142201210001000000000000142301210001000000000000142401210001000000000000142501210001000000000000142601210001000000000000142701210001000000000000142801210001000000000000142901210001000000000000142a01210001000000000000142b01210001000000000000142c01210001000000000000142d01210001000000000000142e01210001000000000000142f01210001000000000000143001210001000000000000143101210001000000000000143201210001000000000000143301210001000000000000143401210001000000000000143501210001000000000000143601210001000000000000143701210001000000000000143801210001000000000000143901210001000000000000143a01210001000000000000143b01210001000000000000143c01210001000000000000143d01210001000000000000143e01210001000000000000143f01210001000000000000144001210001000000000000144101210001000000000000144201210001000000000000144301210001000000000000144401210001000000000000144501210001000000000000144601210001000000000000144701210001000000000000144801210001000000000000144901210001000000000000144a01210001000000000000144b01210001000000000000144c01210001000000000000144d01210001000000000000144e01210001000000000000144f01210001000000000000145001210001000000000000145101210001000000000000145201210001000000000000145301210001000000000000145401210001000000000000145501210001000000000000145601210001000000000000145701210001000000000000145801210001000000000000145901210001000000000000145a01210001000000000000145b01210001000000000000145c01210001000000000000145d01210001000000000000145e01210001000000000000145f01210001000000000000146001210001000000000000146101210001000000000000146201210001000000000000146301210001000000000000146401210001000000000000146501210001000000000000146601210001000000000000146701210001000000000000146801210001000000000000146901210001000000000000146a01210001000000000000146b01210001000000000000146c01210001000000000000146d01210001000000000000146e01210001000000000000146f01210001000000000000147001210001000000000000147101210001000000000000147201210001000000000000147301210001000000000000147401210001000000000000147501210001000000000000147601210001000000000000147701210001000000000000147801210001000000000000147901210001000000000000147a01210001000000000000147b01210001000000000000147c01210001000000000000147d01210001000000000000147e01210001000000000000147f01210001000000000000148001210001000000000000148101210001000000000000148201210001000000000000148301210001000000000000148401210001000000000000148501210001000000000000148601210001000000000000148701210001000000000000148801210001000000000000148901210001000000000000148a01210001000000000000148b01210001000000000000148c01210001000000000000148d01210001000000000000148e01210001000000000000148f01210001000000000000149001210001000000000000149101210001000000000000149201210001000000000000149301210001000000000000149401210001000000000000149501210001000000000000149601210001000000000000149701210001000000000000149801210001000000000000149901210001000000000000149a01210001000000000000149b01210001000000000000149c01210001000000000000149d01210001000000000000149e01210001000000000000149f0121000100000000000014a00121000100000000000014a10121000100000000000014a20121000100000000000014a30121000100000000000014a40121000100000000000014a50121000100000000000014a60121000100000000000014a70121000100000000000014a80121000100000000000014a90121000100000000000014aa0121000100000000000014ab0121000100000000000014ac0121000100000000000014ad0121000100000000000014ae0121000100000000000014af0121000100000000000014b00121000100000000000014b10121000100000000000014b20121000100000000000014b30121000100000000000014b40121000100000000000014b50121000100000000000014b60121000100000000000014b70121000100000000000014b80121000100000000000014b90121000100000000000014ba0121000100000000000014bb0121000100000000000014bc0121000100000000000014bd0121000100000000000014be0121000100000000000014bf0121000100000000000014c00121000100000000000014c10121000100000000000014c20121000100000000000014c30121000100000000000014c40121000100000000000014c50121000100000000000014c60121000100000000000014c70121000100000000000014c80121000100000000000014c90121000100000000000014ca0121000100000000000014cb0121000100000000000014cc0121000100000000000014cd0121000100000000000014ce0121000100000000000014cf0121000100000000000014d00121000100000000000014d10121000100000000000014d20121000100000000000014d30121000100000000000014d40121000100000000000014d50121000100000000000014d60121000100000000000014d70121000100000000000014d80121000100000000000014d90121000100000000000014da0121000100000000000014db0121000100000000000014dc0121000100000000000014dd0121000100000000000014de0121000100000000000014df0121000100000000000014e00121000100000000000014e10121000100000000000014e20121000100000000000014e30121000100000000000014e40121000100000000000014e50121000100000000000014e60121000100000000000014e70121000100000000000014e80121000100000000000014e90121000100000000000014ea0121000100000000000014eb0121000100000000000014ec0121000100000000000014ed0121000100000000000014ee0121000100000000000014ef0121000100000000000014f00121000100000000000014f10121000100000000000014f20121000100000000000014f30121000100000000000014f40121000100000000000014f50121000100000000000014f60121000100000000000014f70121000100000000000014f80121000100000000000014f90121000100000000000014fa0121000100000000000014fb0121000100000000000014fc0121000100000000000014fd0121000100000000000014fe0121000100000000000014ff01210001000000000000150001210001000000000000150101210001000000000000150201210001000000000000150301210001000000000000150401210001000000000000150501210001000000000000150601210001000000000000150701210001000000000000150801210001000000000000150901210001000000000000150a01210001000000000000150b01210001000000000000150c01210001000000000000150d01210001000000000000150e01210001000000000000150f01210001000000000000151001210001000000000000151101210001000000000000151201210001000000000000151301210001000000000000151401210001000000000000151501210001000000000000151601210001000000000000151701210001000000000000151801210001000000000000151901210001000000000000151a01210001000000000000151b01210001000000000000151c01210001000000000000151d01210001000000000000151e01210001000000000000151f01210001000000000000152001210001000000000000152101210001000000000000152201210001000000000000152301210001000000000000152401210001000000000000152501210001000000000000152601210001000000000000152701210001000000000000152801210001000000000000152901210001000000000000152a01210001000000000000152b01210001000000000000152c01210001000000000000152d01210001000000000000152e01210001000000000000152f01210001000000000000153001210001000000000000153101210001000000000000153201210001000000000000153301210001000000000000153401210001000000000000153501210001000000000000153601210001000000000000153701210001000000000000153801210001000000000000153901210001000000000000153a01210001000000000000153b01210001000000000000153c01210001000000000000153d01210001000000000000153e01210001000000000000153f01210001000000000000154001210001000000000000154101210001000000000000154201210001000000000000154301210001000000000000154401210001000000000000154501210001000000000000154601210001000000000000154701210001000000000000154801210001000000000000154901210001000000000000154a01210001000000000000154b01210001000000000000154c01210001000000000000154d01210001000000000000154e01210001000000000000154f01210001000000000000155001210001000000000000155101210001000000000000155201210001000000000000155301210001000000000000155401210001000000000000155501210001000000000000155601210001000000000000155701210001000000000000155801210001000000000000155901210001000000000000155a01210001000000000000155b01210001000000000000155c01210001000000000000155d01210001000000000000155e01210001000000000000155f01210001000000000000156001210001000000000000156101210001000000000000156201210001000000000000156301210001000000000000156401210001000000000000156501210001000000000000156601210001000000000000156701210001000000000000156801210001000000000000156901210001000000000000156a01210001000000000000156b01210001000000000000156c01210001000000000000156d01210001000000000000156e01210001000000000000156f01210001000000000000157001210001000000000000157101210001000000000000157201210001000000000000157301210001000000000000157401210001000000000000157501210001000000000000157601210001000000000000157701210001000000000000157801210001000000000000157901210001000000000000157a01210001000000000000157b01210001000000000000157c01210001000000000000157d01210001000000000000157e01210001000000000000157f01210001000000000000158001210001000000000000158101210001000000000000158201210001000000000000158301210001000000000000158401210001000000000000158501210001000000000000158601210001000000000000158701210001000000000000158801210001000000000000158901210001000000000000158a01210001000000000000158b01210001000000000000158c01210001000000000000158d01210001000000000000158e01210001000000000000158f01210001000000000000159001210001000000000000159101210001000000000000159201210001000000000000159301210001000000000000159401210001000000000000159501210001000000000000159601210001000000000000159701210001000000000000159801210001000000000000159901210001000000000000159a01210001000000000000159b01210001000000000000159c01210001000000000000159d01210001000000000000159e01210001000000000000159f0121000100000000000015a00121000100000000000015a10121000100000000000015a20121000100000000000015a30121000100000000000015a40121000100000000000015a50121000100000000000015a60121000100000000000015a70121000100000000000015a80121000100000000000015a90121000100000000000015aa0121000100000000000015ab0121000100000000000015ac0121000100000000000015ad0121000100000000000015ae0121000100000000000015af0121000100000000000015b00121000100000000000015b10121000100000000000015b20121000100000000000015b30121000100000000000015b40121000100000000000015b50121000100000000000015b60121000100000000000015b70121000100000000000015b80121000100000000000015b90121000100000000000015ba0121000100000000000015bb0121000100000000000015bc0121000100000000000015bd0121000100000000000015be0121000100000000000015bf0121000100000000000015c00121000100000000000015c10121000100000000000015c20121000100000000000015c30121000100000000000015c40121000100000000000015c50121000100000000000015c60121000100000000000015c70121000100000000000015c80121000100000000000015c90121000100000000000015ca0121000100000000000015cb0121000100000000000015cc0121000100000000000015cd0121000100000000000015ce0121000100000000000015cf0121000100000000000015d00121000100000000000015d10121000100000000000015d20121000100000000000015d30121000100000000000015d40121000100000000000015d50121000100000000000015d60121000100000000000015d70121000100000000000015d80121000100000000000015d90121000100000000000015da0121000100000000000015db0121000100000000000015dc0121000100000000000015dd0121000100000000000015de0121000100000000000015df0121000100000000000015e00121000100000000000015e10121000100000000000015e20121000100000000000015e30121000100000000000015e40121000100000000000015e50121000100000000000015e60121000100000000000015e70121000100000000000015e80121000100000000000015e90121000100000000000015ea0121000100000000000015eb0121000100000000000015ec0121000100000000000015ed0121000100000000000015ee0121000100000000000015ef0121000100000000000015f00121000100000000000015f10121000100000000000015f20121000100000000000015f30121000100000000000015f40121000100000000000015f50121000100000000000015f60121000100000000000015f70121000100000000000015f80121000100000000000015f90121000100000000000015fa0121000100000000000015fb0121000100000000000015fc0121000100000000000015fd0121000100000000000015fe0121000100000000000015ff01210001000000000000160001210001000000000000160101210001000000000000160201210001000000000000160301210001000000000000160401210001000000000000160501210001000000000000160601210001000000000000160701210001000000000000160801210001000000000000160901210001000000000000160a01210001000000000000160b01210001000000000000160c01210001000000000000160d01210001000000000000160e01210001000000000000160f01210001000000000000161001210001000000000000161101210001000000000000161201210001000000000000161301210001000000000000161401210001000000000000161501210001000000000000161601210001000000000000161701210001000000000000161801210001000000000000161901210001000000000000161a01210001000000000000161b01210001000000000000161c01210001000000000000161d01210001000000000000161e01210001000000000000161f01210001000000000000162001210001000000000000162101210001000000000000162201210001000000000000162301210001000000000000162401210001000000000000162501210001000000000000162601210001000000000000162701210001000000000000162801210001000000000000162901210001000000000000162a01210001000000000000162b01210001000000000000162c01210001000000000000162d01210001000000000000162e01210001000000000000162f01210001000000000000163001210001000000000000163101210001000000000000163201210001000000000000163301210001000000000000163401210001000000000000163501210001000000000000163601210001000000000000163701210001000000000000163801210001000000000000163901210001000000000000163a01210001000000000000163b01210001000000000000163c01210001000000000000163d01210001000000000000163e01210001000000000000163f01210001000000000000164001210001000000000000164101210001000000000000164201210001000000000000164301210001000000000000164401210001000000000000164501210001000000000000164601210001000000000000164701210001000000000000164801210001000000000000164901210001000000000000164a01210001000000000000164b01210001000000000000164c01210001000000000000164d01210001000000000000164e01210001000000000000164f01210001000000000000165001210001000000000000165101210001000000000000165201210001000000000000165301210001000000000000165401210001000000000000165501210001000000000000165601210001000000000000165701210001000000000000165801210001000000000000165901210001000000000000165a01210001000000000000165b01210001000000000000165c01210001000000000000165d01210001000000000000165e01210001000000000000165f01210001000000000000166001210001000000000000166101210001000000000000166201210001000000000000166301210001000000000000166401210001000000000000166501210001000000000000166601210001000000000000166701210001000000000000166801210001000000000000166901210001000000000000166a01210001000000000000166b01210001000000000000166c01210001000000000000166d01210001000000000000166e01210001000000000000166f01210001000000000000167001210001000000000000167101210001000000000000167201210001000000000000167301210001000000000000167401210001000000000000167501210001000000000000167601210001000000000000167701210001000000000000167801210001000000000000167901210001000000000000167a01210001000000000000167b01210001000000000000167c01210001000000000000167d01210001000000000000167e01210001000000000000167f01210001000000000000168001210001000000000000168101210001000000000000168201210001000000000000168301210001000000000000168401210001000000000000168501210001000000000000168601210001000000000000168701210001000000000000168801210001000000000000168901210001000000000000168a01210001000000000000168b01210001000000000000168c01210001000000000000168d01210001000000000000168e01210001000000000000168f01210001000000000000169001210001000000000000169101210001000000000000169201210001000000000000169301210001000000000000169401210001000000000000169501210001000000000000169601210001000000000000169701210001000000000000169801210001000000000000169901210001000000000000169a01210001000000000000169b01210001000000000000169c01210001000000000000169d01210001000000000000169e01210001000000000000169f0121000100000000000016a00121000100000000000016a10121000100000000000016a20121000100000000000016a30121000100000000000016a40121000100000000000016a50121000100000000000016a60121000100000000000016a70121000100000000000016a80121000100000000000016a90121000100000000000016aa0121000100000000000016ab0121000100000000000016ac0121000100000000000016ad0121000100000000000016ae0121000100000000000016af0121000100000000000016b00121000100000000000016b10121000100000000000016b20121000100000000000016b30121000100000000000016b40121000100000000000016b50121000100000000000016b60121000100000000000016b70121000100000000000016b80121000100000000000016b90121000100000000000016ba0121000100000000000016bb0121000100000000000016bc0121000100000000000016bd0121000100000000000016be0121000100000000000016bf0121000100000000000016c00121000100000000000016c10121000100000000000016c20121000100000000000016c30121000100000000000016c40121000100000000000016c50121000100000000000016c60121000100000000000016c70121000100000000000016c80121000100000000000016c90121000100000000000016ca0121000100000000000016cb0121000100000000000016cc0121000100000000000016cd0121000100000000000016ce0121000100000000000016cf0121000100000000000016d00121000100000000000016d10121000100000000000016d20121000100000000000016d30121000100000000000016d40121000100000000000016d50121000100000000000016d60121000100000000000016d70121000100000000000016d80121000100000000000016d90121000100000000000016da0121000100000000000016db0121000100000000000016dc0121000100000000000016dd0121000100000000000016de0121000100000000000016df0121000100000000000016e00121000100000000000016e10121000100000000000016e20121000100000000000016e30121000100000000000016e40121000100000000000016e50121000100000000000016e60121000100000000000016e70121000100000000000016e80121000100000000000016e90121000100000000000016ea0121000100000000000016eb0121000100000000000016ec0121000100000000000016ed0121000100000000000016ee0121000100000000000016ef0121000100000000000016f00121000100000000000016f10121000100000000000016f20121000100000000000016f30121000100000000000016f40121000100000000000016f50121000100000000000016f60121000100000000000016f70121000100000000000016f80121000100000000000016f90121000100000000000016fa0121000100000000000016fb0121000100000000000016fc0121000100000000000016fd0121000100000000000016fe0121000100000000000016ff01210001000000000000170001210001000000000000170101210001000000000000170201210001000000000000170301210001000000000000170401210001000000000000170501210001000000000000170601210001000000000000170701210001000000000000170801210001000000000000170901210001000000000000170a01210001000000000000170b01210001000000000000170c01210001000000000000170d01210001000000000000170e01210001000000000000170f01210001000000000000171001210001000000000000171101210001000000000000171201210001000000000000171301210001000000000000171401210001000000000000171501210001000000000000171601210001000000000000171701210001000000000000171801210001000000000000171901210001000000000000171a01210001000000000000171b01210001000000000000171c01210001000000000000171d01210001000000000000171e01210001000000000000171f01210001000000000000172001210001000000000000172101210001000000000000172201210001000000000000172301210001000000000000172401210001000000000000172501210001000000000000172601210001000000000000172701210001000000000000172801210001000000000000172901210001000000000000172a01210001000000000000172b01210001000000000000172c01210001000000000000172d01210001000000000000172e01210001000000000000172f01210001000000000000173001210001000000000000173101210001000000000000173201210001000000000000173301210001000000000000173401210001000000000000173501210001000000000000173601210001000000000000173701210001000000000000173801210001000000000000173901210001000000000000173a01210001000000000000173b01210001000000000000173c01210001000000000000173d01210001000000000000173e01210001000000000000173f01210001000000000000174001210001000000000000174101210001000000000000174201210001000000000000174301210001000000000000174401210001000000000000174501210001000000000000174601210001000000000000174701210001000000000000174801210001000000000000174901210001000000000000174a01210001000000000000174b01210001000000000000174c01210001000000000000174d01210001000000000000174e01210001000000000000174f01210001000000000000175001210001000000000000175101210001000000000000175201210001000000000000175301210001000000000000175401210001000000000000175501210001000000000000175601210001000000000000175701210001000000000000175801210001000000000000175901210001000000000000175a01210001000000000000175b01210001000000000000175c01210001000000000000175d01210001000000000000175e01210001000000000000175f01210001000000000000176001210001000000000000176101210001000000000000176201210001000000000000176301210001000000000000176401210001000000000000176501210001000000000000176601210001000000000000176701210001000000000000176801210001000000000000176901210001000000000000176a01210001000000000000176b01210001000000000000176c01210001000000000000176d01210001000000000000176e01210001000000000000176f01210001000000000000177001210001000000000000177101210001000000000000177201210001000000000000177301210001000000000000177401210001000000000000177501210001000000000000177601210001000000000000177701210001000000000000177801210001000000000000177901210001000000000000177a01210001000000000000177b01210001000000000000177c01210001000000000000177d01210001000000000000177e01210001000000000000177f01210001000000000000178001210001000000000000178101210001000000000000178201210001000000000000178301210001000000000000178401210001000000000000178501210001000000000000178601210001000000000000178701210001000000000000178801210001000000000000178901210001000000000000178a01210001000000000000178b01210001000000000000178c01210001000000000000178d01210001000000000000178e01210001000000000000178f01210001000000000000179001210001000000000000179101210001000000000000179201210001000000000000179301210001000000000000179401210001000000000000179501210001000000000000179601210001000000000000179701210001000000000000179801210001000000000000179901210001000000000000179a01210001000000000000179b01210001000000000000179c01210001000000000000179d01210001000000000000179e01210001000000000000179f0121000100000000000017a00121000100000000000017a10121000100000000000017a20121000100000000000017a30121000100000000000017a40121000100000000000017a50121000100000000000017a60121000100000000000017a70121000100000000000017a80121000100000000000017a90121000100000000000017aa0121000100000000000017ab0121000100000000000017ac0121000100000000000017ad0121000100000000000017ae0121000100000000000017af0121000100000000000017b00121000100000000000017b10121000100000000000017b20121000100000000000017b30121000100000000000017b40121000100000000000017b50121000100000000000017b60121000100000000000017b70121000100000000000017b80121000100000000000017b90121000100000000000017ba0121000100000000000017bb0121000100000000000017bc0121000100000000000017bd0121000100000000000017be0121000100000000000017bf0121000100000000000017c00121000100000000000017c10121000100000000000017c20121000100000000000017c30121000100000000000017c40121000100000000000017c50121000100000000000017c60121000100000000000017c70121000100000000000017c80121000100000000000017c90121000100000000000017ca0121000100000000000017cb0121000100000000000017cc0121000100000000000017cd0121000100000000000017ce0121000100000000000017cf0121000100000000000017d00121000100000000000017d10121000100000000000017d20121000100000000000017d30121000100000000000017d40121000100000000000017d50121000100000000000017d60121000100000000000017d70121000100000000000017d80121000100000000000017d90121000100000000000017da0121000100000000000017db0121000100000000000017dc0121000100000000000017dd0121000100000000000017de0121000100000000000017df0121000100000000000017e00121000100000000000017e10121000100000000000017e20121000100000000000017e30121000100000000000017e40121000100000000000017e50121000100000000000017e60121000100000000000017e70121000100000000000017e80121000100000000000017e90121000100000000000017ea0121000100000000000017eb0121000100000000000017ec0121000100000000000017ed0121000100000000000017ee0121000100000000000017ef0121000100000000000017f00121000100000000000017f10121000100000000000017f20121000100000000000017f30121000100000000000017f40121000100000000000017f50121000100000000000017f60121000100000000000017f70121000100000000000017f80121000100000000000017f90121000100000000000017fa0121000100000000000017fb0121000100000000000017fc0121000100000000000017fd0121000100000000000017fe0121000100000000000017ff01210001000000000000180001210001000000000000180101210001000000000000180201210001000000000000180301210001000000000000180401210001000000000000180501210001000000000000180601210001000000000000180701210001000000000000180801210001000000000000180901210001000000000000180a01210001000000000000180b01210001000000000000180c01210001000000000000180d01210001000000000000180e01210001000000000000180f01210001000000000000181001210001000000000000181101210001000000000000181201210001000000000000181301210001000000000000181401210001000000000000181501210001000000000000181601210001000000000000181701210001000000000000181801210001000000000000181901210001000000000000181a01210001000000000000181b01210001000000000000181c01210001000000000000181d01210001000000000000181e01210001000000000000181f01210001000000000000182001210001000000000000182101210001000000000000182201210001000000000000182301210001000000000000182401210001000000000000182501210001000000000000182601210001000000000000182701210001000000000000182801210001000000000000182901210001000000000000182a01210001000000000000182b01210001000000000000182c01210001000000000000182d01210001000000000000182e01210001000000000000182f01210001000000000000183001210001000000000000183101210001000000000000183201210001000000000000183301210001000000000000183401210001000000000000183501210001000000000000183601210001000000000000183701210001000000000000183801210001000000000000183901210001000000000000183a01210001000000000000183b01210001000000000000183c01210001000000000000183d01210001000000000000183e01210001000000000000183f01210001000000000000184001210001000000000000184101210001000000000000184201210001000000000000184301210001000000000000184401210001000000000000184501210001000000000000184601210001000000000000184701210001000000000000184801210001000000000000184901210001000000000000184a01210001000000000000184b01210001000000000000184c01210001000000000000184d01210001000000000000184e01210001000000000000184f01210001000000000000185001210001000000000000185101210001000000000000185201210001000000000000185301210001000000000000185401210001000000000000185501210001000000000000185601210001000000000000185701210001000000000000185801210001000000000000185901210001000000000000185a01210001000000000000185b01210001000000000000185c01210001000000000000185d01210001000000000000185e01210001000000000000185f01210001000000000000186001210001000000000000186101210001000000000000186201210001000000000000186301210001000000000000186401210001000000000000186501210001000000000000186601210001000000000000186701210001000000000000186801210001000000000000186901210001000000000000186a01210001000000000000186b01210001000000000000186c01210001000000000000186d01210001000000000000186e01210001000000000000186f01210001000000000000187001210001000000000000187101210001000000000000187201210001000000000000187301210001000000000000187401210001000000000000187501210001000000000000187601210001000000000000187701210001000000000000187801210001000000000000187901210001000000000000187a01210001000000000000187b01210001000000000000187c01210001000000000000187d01210001000000000000187e01210001000000000000187f01210001000000000000188001210001000000000000188101210001000000000000188201210001000000000000188301210001000000000000188401210001000000000000188501210001000000000000188601210001000000000000188701210001000000000000188801210001000000000000188901210001000000000000188a01210001000000000000188b01210001000000000000188c01210001000000000000188d01210001000000000000188e01210001000000000000188f01210001000000000000189001210001000000000000189101210001000000000000189201210001000000000000189301210001000000000000189401210001000000000000189501210001000000000000189601210001000000000000189701210001000000000000189801210001000000000000189901210001000000000000189a01210001000000000000189b01210001000000000000189c01210001000000000000189d01210001000000000000189e01210001000000000000189f0121000100000000000018a00121000100000000000018a10121000100000000000018a20121000100000000000018a30121000100000000000018a40121000100000000000018a50121000100000000000018a60121000100000000000018a70121000100000000000018a80121000100000000000018a90121000100000000000018aa0121000100000000000018ab0121000100000000000018ac0121000100000000000018ad0121000100000000000018ae0121000100000000000018af0121000100000000000018b00121000100000000000018b10121000100000000000018b20121000100000000000018b30121000100000000000018b40121000100000000000018b50121000100000000000018b60121000100000000000018b70121000100000000000018b80121000100000000000018b90121000100000000000018ba0121000100000000000018bb0121000100000000000018bc0121000100000000000018bd0121000100000000000018be0121000100000000000018bf0121000100000000000018c00121000100000000000018c10121000100000000000018c20121000100000000000018c30121000100000000000018c40121000100000000000018c50121000100000000000018c60121000100000000000018c70121000100000000000018c80121000100000000000018c90121000100000000000018ca0121000100000000000018cb0121000100000000000018cc0121000100000000000018cd0121000100000000000018ce0121000100000000000018cf0121000100000000000018d00121000100000000000018d10121000100000000000018d20121000100000000000018d30121000100000000000018d40121000100000000000018d50121000100000000000018d60121000100000000000018d70121000100000000000018d80121000100000000000018d90121000100000000000018da0121000100000000000018db0121000100000000000018dc0121000100000000000018dd0121000100000000000018de0121000100000000000018df0121000100000000000018e00121000100000000000018e10121000100000000000018e20121000100000000000018e30121000100000000000018e40121000100000000000018e50121000100000000000018e60121000100000000000018e70121000100000000000018e80121000100000000000018e90121000100000000000018ea0121000100000000000018eb0121000100000000000018ec0121000100000000000018ed0121000100000000000018ee0121000100000000000018ef0121000100000000000018f00121000100000000000018f10121000100000000000018f20121000100000000000018f30121000100000000000018f40121000100000000000018f50121000100000000000018f60121000100000000000018f70121000100000000000018f80121000100000000000018f90121000100000000000018fa0121000100000000000018fb0121000100000000000018fc0121000100000000000018fd0121000100000000000018fe0121000100000000000018ff01210001000000000000190001210001000000000000190101210001000000000000190201210001000000000000190301210001000000000000190401210001000000000000190501210001000000000000190601210001000000000000190701210001000000000000190801210001000000000000190901210001000000000000190a01210001000000000000190b01210001000000000000190c01210001000000000000190d01210001000000000000190e01210001000000000000190f01210001000000000000191001210001000000000000191101210001000000000000191201210001000000000000191301210001000000000000191401210001000000000000191501210001000000000000191601210001000000000000191701210001000000000000191801210001000000000000191901210001000000000000191a01210001000000000000191b01210001000000000000191c01210001000000000000191d01210001000000000000191e01210001000000000000191f01210001000000000000192001210001000000000000192101210001000000000000192201210001000000000000192301210001000000000000192401210001000000000000192501210001000000000000192601210001000000000000192701210001000000000000192801210001000000000000192901210001000000000000192a01210001000000000000192b01210001000000000000192c01210001000000000000192d01210001000000000000192e01210001000000000000192f01210001000000000000193001210001000000000000193101210001000000000000193201210001000000000000193301210001000000000000193401210001000000000000193501210001000000000000193601210001000000000000193701210001000000000000193801210001000000000000193901210001000000000000193a01210001000000000000193b01210001000000000000193c01210001000000000000193d01210001000000000000193e01210001000000000000193f01210001000000000000194001210001000000000000194101210001000000000000194201210001000000000000194301210001000000000000194401210001000000000000194501210001000000000000194601210001000000000000194701210001000000000000194801210001000000000000194901210001000000000000194a01210001000000000000194b01210001000000000000194c01210001000000000000194d01210001000000000000194e01210001000000000000194f01210001000000000000195001210001000000000000195101210001000000000000195201210001000000000000195301210001000000000000195401210001000000000000195501210001000000000000195601210001000000000000195701210001000000000000195801210001000000000000195901210001000000000000195a01210001000000000000195b01210001000000000000195c01210001000000000000195d01210001000000000000195e01210001000000000000195f01210001000000000000196001210001000000000000196101210001000000000000196201210001000000000000196301210001000000000000196401210001000000000000196501210001000000000000196601210001000000000000196701210001000000000000196801210001000000000000196901210001000000000000196a01210001000000000000196b01210001000000000000196c01210001000000000000196d01210001000000000000196e01210001000000000000196f01210001000000000000197001210001000000000000197101210001000000000000197201210001000000000000197301210001000000000000197401210001000000000000197501210001000000000000197601210001000000000000197701210001000000000000197801210001000000000000197901210001000000000000197a01210001000000000000197b01210001000000000000197c01210001000000000000197d01210001000000000000197e01210001000000000000197f01210001000000000000198001210001000000000000198101210001000000000000198201210001000000000000198301210001000000000000198401210001000000000000198501210001000000000000198601210001000000000000198701210001000000000000198801210001000000000000198901210001000000000000198a01210001000000000000198b01210001000000000000198c01210001000000000000198d01210001000000000000198e01210001000000000000198f01210001000000000000199001210001000000000000199101210001000000000000199201210001000000000000199301210001000000000000199401210001000000000000199501210001000000000000199601210001000000000000199701210001000000000000199801210001000000000000199901210001000000000000199a01210001000000000000199b01210001000000000000199c01210001000000000000199d01210001000000000000199e01210001000000000000199f0121000100000000000019a00121000100000000000019a10121000100000000000019a20121000100000000000019a30121000100000000000019a40121000100000000000019a50121000100000000000019a60121000100000000000019a70121000100000000000019a80121000100000000000019a90121000100000000000019aa0121000100000000000019ab0121000100000000000019ac0121000100000000000019ad0121000100000000000019ae0121000100000000000019af0121000100000000000019b00121000100000000000019b10121000100000000000019b20121000100000000000019b30121000100000000000019b40121000100000000000019b50121000100000000000019b60121000100000000000019b70121000100000000000019b80121000100000000000019b90121000100000000000019ba0121000100000000000019bb0121000100000000000019bc0121000100000000000019bd0121000100000000000019be0121000100000000000019bf0121000100000000000019c00121000100000000000019c10121000100000000000019c20121000100000000000019c30121000100000000000019c40121000100000000000019c50121000100000000000019c60121000100000000000019c70121000100000000000019c80121000100000000000019c90121000100000000000019ca0121000100000000000019cb0121000100000000000019cc0121000100000000000019cd0121000100000000000019ce0121000100000000000019cf0121000100000000000019d00121000100000000000019d10121000100000000000019d20121000100000000000019d30121000100000000000019d40121000100000000000019d50121000100000000000019d60121000100000000000019d70121000100000000000019d80121000100000000000019d90121000100000000000019da0121000100000000000019db0121000100000000000019dc0121000100000000000019dd0121000100000000000019de0121000100000000000019df0121000100000000000019e00121000100000000000019e10121000100000000000019e20121000100000000000019e30121000100000000000019e40121000100000000000019e50121000100000000000019e60121000100000000000019e70121000100000000000019e80121000100000000000019e90121000100000000000019ea0121000100000000000019eb0121000100000000000019ec0121000100000000000019ed0121000100000000000019ee0121000100000000000019ef0121000100000000000019f00121000100000000000019f10121000100000000000019f20121000100000000000019f30121000100000000000019f40121000100000000000019f50121000100000000000019f60121000100000000000019f70121000100000000000019f80121000100000000000019f90121000100000000000019fa0121000100000000000019fb0121000100000000000019fc0121000100000000000019fd0121000100000000000019fe0121000100000000000019ff012100010000000000001a00012100010000000000001a01012100010000000000001a02012100010000000000001a03012100010000000000001a04012100010000000000001a05012100010000000000001a06012100010000000000001a07012100010000000000001a08012100010000000000001a09012100010000000000001a0a012100010000000000001a0b012100010000000000001a0c012100010000000000001a0d012100010000000000001a0e012100010000000000001a0f012100010000000000001a10012100010000000000001a11012100010000000000001a12012100010000000000001a13012100010000000000001a14012100010000000000001a15012100010000000000001a16012100010000000000001a17012100010000000000001a18012100010000000000001a19012100010000000000001a1a012100010000000000001a1b012100010000000000001a1c012100010000000000001a1d012100010000000000001a1e012100010000000000001a1f012100010000000000001a20012100010000000000001a21012100010000000000001a22012100010000000000001a23012100010000000000001a24012100010000000000001a25012100010000000000001a26012100010000000000001a27012100010000000000001a28012100010000000000001a29012100010000000000001a2a012100010000000000001a2b012100010000000000001a2c012100010000000000001a2d012100010000000000001a2e012100010000000000001a2f012100010000000000001a30012100010000000000001a31012100010000000000001a32012100010000000000001a33012100010000000000001a34012100010000000000001a35012100010000000000001a36012100010000000000001a37012100010000000000001a38012100010000000000001a39012100010000000000001a3a012100010000000000001a3b012100010000000000001a3c012100010000000000001a3d012100010000000000001a3e012100010000000000001a3f012100010000000000001a40012100010000000000001a41012100010000000000001a42012100010000000000001a43012100010000000000001a44012100010000000000001a45012100010000000000001a46012100010000000000001a47012100010000000000001a48012100010000000000001a49012100010000000000001a4a012100010000000000001a4b012100010000000000001a4c012100010000000000001a4d012100010000000000001a4e012100010000000000001a4f012100010000000000001a50012100010000000000001a51012100010000000000001a52012100010000000000001a53012100010000000000001a54012100010000000000001a55012100010000000000001a56012100010000000000001a57012100010000000000001a58012100010000000000001a59012100010000000000001a5a012100010000000000001a5b012100010000000000001a5c012100010000000000001a5d012100010000000000001a5e012100010000000000001a5f012100010000000000001a60012100010000000000001a61012100010000000000001a62012100010000000000001a63012100010000000000001a64012100010000000000001a65012100010000000000001a66012100010000000000001a67012100010000000000001a68012100010000000000001a69012100010000000000001a6a012100010000000000001a6b012100010000000000001a6c012100010000000000001a6d012100010000000000001a6e012100010000000000001a6f012100010000000000001a70012100010000000000001a71012100010000000000001a72012100010000000000001a73012100010000000000001a74012100010000000000001a75012100010000000000001a76012100010000000000001a77012100010000000000001a78012100010000000000001a79012100010000000000001a7a012100010000000000001a7b012100010000000000001a7c012100010000000000001a7d012100010000000000001a7e012100010000000000001a7f012100010000000000001a80012100010000000000001a81012100010000000000001a82012100010000000000001a83012100010000000000001a84012100010000000000001a85012100010000000000001a86012100010000000000001a87012100010000000000001a88012100010000000000001a89012100010000000000001a8a012100010000000000001a8b012100010000000000001a8c012100010000000000001a8d012100010000000000001a8e012100010000000000001a8f012100010000000000001a90012100010000000000001a91012100010000000000001a92012100010000000000001a93012100010000000000001a94012100010000000000001a95012100010000000000001a96012100010000000000001a97012100010000000000001a98012100010000000000001a99012100010000000000001a9a012100010000000000001a9b012100010000000000001a9c012100010000000000001a9d012100010000000000001a9e012100010000000000001a9f012100010000000000001aa0012100010000000000001aa1012100010000000000001aa2012100010000000000001aa3012100010000000000001aa4012100010000000000001aa5012100010000000000001aa6012100010000000000001aa7012100010000000000001aa8012100010000000000001aa9012100010000000000001aaa012100010000000000001aab012100010000000000001aac012100010000000000001aad012100010000000000001aae012100010000000000001aaf012100010000000000001ab0012100010000000000001ab1012100010000000000001ab2012100010000000000001ab3012100010000000000001ab4012100010000000000001ab5012100010000000000001ab6012100010000000000001ab7012100010000000000001ab8012100010000000000001ab9012100010000000000001aba012100010000000000001abb012100010000000000001abc012100010000000000001abd012100010000000000001abe012100010000000000001abf012100010000000000001ac0012100010000000000001ac1012100010000000000001ac2012100010000000000001ac3012100010000000000001ac4012100010000000000001ac5012100010000000000001ac6012100010000000000001ac7012100010000000000001ac8012100010000000000001ac9012100010000000000001aca012100010000000000001acb012100010000000000001acc012100010000000000001acd012100010000000000001ace012100010000000000001acf012100010000000000001ad0012100010000000000001ad1012100010000000000001ad2012100010000000000001ad3012100010000000000001ad4012100010000000000001ad5012100010000000000001ad6012100010000000000001ad7012100010000000000001ad8012100010000000000001ad9012100010000000000001ada012100010000000000001adb012100010000000000001adc012100010000000000001add012100010000000000001ade012100010000000000001adf012100010000000000001ae0012100010000000000001ae1012100010000000000001ae2012100010000000000001ae3012100010000000000001ae4012100010000000000001ae5012100010000000000001ae6012100010000000000001ae7012100010000000000001ae8012100010000000000001ae9012100010000000000001aea012100010000000000001aeb012100010000000000001aec012100010000000000001aed012100010000000000001aee012100010000000000001aef012100010000000000001af0012100010000000000001af1012100010000000000001af2012100010000000000001af3012100010000000000001af4012100010000000000001af5012100010000000000001af6012100010000000000001af7012100010000000000001af8012100010000000000001af9012100010000000000001afa012100010000000000001afb012100010000000000001afc012100010000000000001afd012100010000000000001afe012100010000000000001aff012100010000000000001b00012100010000000000001b01012100010000000000001b02012100010000000000001b03012100010000000000001b04012100010000000000001b05012100010000000000001b06012100010000000000001b07012100010000000000001b08012100010000000000001b09012100010000000000001b0a012100010000000000001b0b012100010000000000001b0c012100010000000000001b0d012100010000000000001b0e012100010000000000001b0f012100010000000000001b10012100010000000000001b11012100010000000000001b12012100010000000000001b13012100010000000000001b14012100010000000000001b15012100010000000000001b16012100010000000000001b17012100010000000000001b18012100010000000000001b19012100010000000000001b1a012100010000000000001b1b012100010000000000001b1c012100010000000000001b1d012100010000000000001b1e012100010000000000001b1f012100010000000000001b20012100010000000000001b21012100010000000000001b22012100010000000000001b23012100010000000000001b24012100010000000000001b25012100010000000000001b26012100010000000000001b27012100010000000000001b28012100010000000000001b29012100010000000000001b2a012100010000000000001b2b012100010000000000001b2c012100010000000000001b2d012100010000000000001b2e012100010000000000001b2f012100010000000000001b30012100010000000000001b31012100010000000000001b32012100010000000000001b33012100010000000000001b34012100010000000000001b35012100010000000000001b36012100010000000000001b37012100010000000000001b38012100010000000000001b39012100010000000000001b3a012100010000000000001b3b012100010000000000001b3c012100010000000000001b3d012100010000000000001b3e012100010000000000001b3f012100010000000000001b40012100010000000000001b41012100010000000000001b42012100010000000000001b43012100010000000000001b44012100010000000000001b45012100010000000000001b46012100010000000000001b47012100010000000000001b48012100010000000000001b49012100010000000000001b4a012100010000000000001b4b012100010000000000001b4c012100010000000000001b4d012100010000000000001b4e012100010000000000001b4f012100010000000000001b50012100010000000000001b51012100010000000000001b52012100010000000000001b53012100010000000000001b54012100010000000000001b55012100010000000000001b56012100010000000000001b57012100010000000000001b58012100010000000000001b59012100010000000000001b5a012100010000000000001b5b012100010000000000001b5c012100010000000000001b5d012100010000000000001b5e012100010000000000001b5f012100010000000000001b60012100010000000000001b61012100010000000000001b62012100010000000000001b63012100010000000000001b64012100010000000000001b65012100010000000000001b66012100010000000000001b67012100010000000000001b68012100010000000000001b69012100010000000000001b6a012100010000000000001b6b012100010000000000001b6c012100010000000000001b6d012100010000000000001b6e012100010000000000001b6f012100010000000000001b70012100010000000000001b71012100010000000000001b72012100010000000000001b73012100010000000000001b74012100010000000000001b75012100010000000000001b76012100010000000000001b77012100010000000000001b78012100010000000000001b79012100010000000000001b7a012100010000000000001b7b012100010000000000001b7c012100010000000000001b7d012100010000000000001b7e012100010000000000001b7f012100010000000000001b80012100010000000000001b81012100010000000000001b82012100010000000000001b83012100010000000000001b84012100010000000000001b85012100010000000000001b86012100010000000000001b87012100010000000000001b88012100010000000000001b89012100010000000000001b8a012100010000000000001b8b012100010000000000001b8c012100010000000000001b8d012100010000000000001b8e012100010000000000001b8f012100010000000000001b90012100010000000000001b91012100010000000000001b92012100010000000000001b93012100010000000000001b94012100010000000000001b95012100010000000000001b96012100010000000000001b97012100010000000000001b98012100010000000000001b99012100010000000000001b9a012100010000000000001b9b012100010000000000001b9c012100010000000000001b9d012100010000000000001b9e012100010000000000001b9f012100010000000000001ba0012100010000000000001ba1012100010000000000001ba2012100010000000000001ba3012100010000000000001ba4012100010000000000001ba5012100010000000000001ba6012100010000000000001ba7012100010000000000001ba8012100010000000000001ba9012100010000000000001baa012100010000000000001bab012100010000000000001bac012100010000000000001bad012100010000000000001bae012100010000000000001baf012100010000000000001bb0012100010000000000001bb1012100010000000000001bb2012100010000000000001bb3012100010000000000001bb4012100010000000000001bb5012100010000000000001bb6012100010000000000001bb7012100010000000000001bb8012100010000000000001bb9012100010000000000001bba012100010000000000001bbb012100010000000000001bbc012100010000000000001bbd012100010000000000001bbe012100010000000000001bbf012100010000000000001bc0012100010000000000001bc1012100010000000000001bc2012100010000000000001bc3012100010000000000001bc4012100010000000000001bc5012100010000000000001bc6012100010000000000001bc7012100010000000000001bc8012100010000000000001bc9012100010000000000001bca012100010000000000001bcb012100010000000000001bcc012100010000000000001bcd012100010000000000001bce012100010000000000001bcf012100010000000000001bd0012100010000000000001bd1012100010000000000001bd2012100010000000000001bd3012100010000000000001bd4012100010000000000001bd5012100010000000000001bd6012100010000000000001bd7012100010000000000001bd8012100010000000000001bd9012100010000000000001bda012100010000000000001bdb012100010000000000001bdc012100010000000000001bdd012100010000000000001bde012100010000000000001bdf012100010000000000001be0012100010000000000001be1012100010000000000001be2012100010000000000001be3012100010000000000001be4012100010000000000001be5012100010000000000001be6012100010000000000001be7012100010000000000001be8012100010000000000001be9012100010000000000001bea012100010000000000001beb012100010000000000001bec012100010000000000001bed012100010000000000001bee012100010000000000001bef012100010000000000001bf0012100010000000000001bf1012100010000000000001bf2012100010000000000001bf3012100010000000000001bf4012100010000000000001bf5012100010000000000001bf6012100010000000000001bf7012100010000000000001bf8012100010000000000001bf9012100010000000000001bfa012100010000000000001bfb012100010000000000001bfc012100010000000000001bfd012100010000000000001bfe012100010000000000001bff012100010000000000001c00012100010000000000001c01012100010000000000001c02012100010000000000001c03012100010000000000001c04012100010000000000001c05012100010000000000001c06012100010000000000001c07012100010000000000001c08012100010000000000001c09012100010000000000001c0a012100010000000000001c0b012100010000000000001c0c012100010000000000001c0d012100010000000000001c0e012100010000000000001c0f012100010000000000001c10012100010000000000001c11012100010000000000001c12012100010000000000001c13012100010000000000001c14012100010000000000001c15012100010000000000001c16012100010000000000001c17012100010000000000001c18012100010000000000001c19012100010000000000001c1a012100010000000000001c1b012100010000000000001c1c012100010000000000001c1d012100010000000000001c1e012100010000000000001c1f012100010000000000001c20012100010000000000001c21012100010000000000001c22012100010000000000001c23012100010000000000001c24012100010000000000001c25012100010000000000001c26012100010000000000001c27012100010000000000001c28012100010000000000001c29012100010000000000001c2a012100010000000000001c2b012100010000000000001c2c012100010000000000001c2d012100010000000000001c2e012100010000000000001c2f012100010000000000001c30012100010000000000001c31012100010000000000001c32012100010000000000001c33012100010000000000001c34012100010000000000001c35012100010000000000001c36012100010000000000001c37012100010000000000001c38012100010000000000001c39012100010000000000001c3a012100010000000000001c3b012100010000000000001c3c012100010000000000001c3d012100010000000000001c3e012100010000000000001c3f012100010000000000001c40012100010000000000001c41012100010000000000001c42012100010000000000001c43012100010000000000001c44012100010000000000001c45012100010000000000001c46012100010000000000001c47012100010000000000001c48012100010000000000001c49012100010000000000001c4a012100010000000000001c4b012100010000000000001c4c012100010000000000001c4d012100010000000000001c4e012100010000000000001c4f012100010000000000001c50012100010000000000001c51012100010000000000001c52012100010000000000001c53012100010000000000001c54012100010000000000001c55012100010000000000001c56012100010000000000001c57012100010000000000001c58012100010000000000001c59012100010000000000001c5a012100010000000000001c5b012100010000000000001c5c012100010000000000001c5d012100010000000000001c5e012100010000000000001c5f012100010000000000001c60012100010000000000001c61012100010000000000001c62012100010000000000001c63012100010000000000001c64012100010000000000001c65012100010000000000001c66012100010000000000001c67012100010000000000001c68012100010000000000001c69012100010000000000001c6a012100010000000000001c6b012100010000000000001c6c012100010000000000001c6d012100010000000000001c6e012100010000000000001c6f012100010000000000001c70012100010000000000001c71012100010000000000001c72012100010000000000001c73012100010000000000001c74012100010000000000001c75012100010000000000001c76012100010000000000001c77012100010000000000001c78012100010000000000001c79012100010000000000001c7a012100010000000000001c7b012100010000000000001c7c012100010000000000001c7d012100010000000000001c7e012100010000000000001c7f012100010000000000001c80012100010000000000001c81012100010000000000001c82012100010000000000001c83012100010000000000001c84012100010000000000001c85012100010000000000001c86012100010000000000001c87012100010000000000001c88012100010000000000001c89012100010000000000001c8a012100010000000000001c8b012100010000000000001c8c012100010000000000001c8d012100010000000000001c8e012100010000000000001c8f012100010000000000001c90012100010000000000001c91012100010000000000001c92012100010000000000001c93012100010000000000001c94012100010000000000001c95012100010000000000001c96012100010000000000001c97012100010000000000001c98012100010000000000001c99012100010000000000001c9a012100010000000000001c9b012100010000000000001c9c012100010000000000001c9d012100010000000000001c9e012100010000000000001c9f012100010000000000001ca0012100010000000000001ca1012100010000000000001ca2012100010000000000001ca3012100010000000000001ca4012100010000000000001ca5012100010000000000001ca6012100010000000000001ca7012100010000000000001ca8012100010000000000001ca9012100010000000000001caa012100010000000000001cab012100010000000000001cac012100010000000000001cad012100010000000000001cae012100010000000000001caf012100010000000000001cb0012100010000000000001cb1012100010000000000001cb2012100010000000000001cb3012100010000000000001cb4012100010000000000001cb5012100010000000000001cb6012100010000000000001cb7012100010000000000001cb8012100010000000000001cb9012100010000000000001cba012100010000000000001cbb012100010000000000001cbc012100010000000000001cbd012100010000000000001cbe012100010000000000001cbf012100010000000000001cc0012100010000000000001cc1012100010000000000001cc2012100010000000000001cc3012100010000000000001cc4012100010000000000001cc5012100010000000000001cc6012100010000000000001cc7012100010000000000001cc8012100010000000000001cc9012100010000000000001cca012100010000000000001ccb012100010000000000001ccc012100010000000000001ccd012100010000000000001cce012100010000000000001ccf012100010000000000001cd0012100010000000000001cd1012100010000000000001cd2012100010000000000001cd3012100010000000000001cd4012100010000000000001cd5012100010000000000001cd6012100010000000000001cd7012100010000000000001cd8012100010000000000001cd9012100010000000000001cda012100010000000000001cdb012100010000000000001cdc012100010000000000001cdd012100010000000000001cde012100010000000000001cdf012100010000000000001ce0012100010000000000001ce1012100010000000000001ce2012100010000000000001ce3012100010000000000001ce4012100010000000000001ce5012100010000000000001ce6012100010000000000001ce7012100010000000000001ce8012100010000000000001ce9012100010000000000001cea012100010000000000001ceb012100010000000000001cec012100010000000000001ced012100010000000000001cee012100010000000000001cef012100010000000000001cf0012100010000000000001cf1012100010000000000001cf2012100010000000000001cf3012100010000000000001cf4012100010000000000001cf5012100010000000000001cf6012100010000000000001cf7012100010000000000001cf8012100010000000000001cf9012100010000000000001cfa012100010000000000001cfb012100010000000000001cfc012100010000000000001cfd012100010000000000001cfe012100010000000000001cff012100010000000000001d00012100010000000000001d01012100010000000000001d02012100010000000000001d03012100010000000000001d04012100010000000000001d05012100010000000000001d06012100010000000000001d07012100010000000000001d08012100010000000000001d09012100010000000000001d0a012100010000000000001d0b012100010000000000001d0c012100010000000000001d0d012100010000000000001d0e012100010000000000001d0f012100010000000000001d10012100010000000000001d11012100010000000000001d12012100010000000000001d13012100010000000000001d14012100010000000000001d15012100010000000000001d16012100010000000000001d17012100010000000000001d18012100010000000000001d19012100010000000000001d1a012100010000000000001d1b012100010000000000001d1c012100010000000000001d1d012100010000000000001d1e012100010000000000001d1f012100010000000000001d20012100010000000000001d21012100010000000000001d22012100010000000000001d23012100010000000000001d24012100010000000000001d25012100010000000000001d26012100010000000000001d27012100010000000000001d28012100010000000000001d29012100010000000000001d2a012100010000000000001d2b012100010000000000001d2c012100010000000000001d2d012100010000000000001d2e012100010000000000001d2f012100010000000000001d30012100010000000000001d31012100010000000000001d32012100010000000000001d33012100010000000000001d34012100010000000000001d35012100010000000000001d36012100010000000000001d37012100010000000000001d38012100010000000000001d39012100010000000000001d3a012100010000000000001d3b012100010000000000001d3c012100010000000000001d3d012100010000000000001d3e012100010000000000001d3f012100010000000000001d40012100010000000000001d41012100010000000000001d42012100010000000000001d43012100010000000000001d44012100010000000000001d45012100010000000000001d46012100010000000000001d47012100010000000000001d48012100010000000000001d49012100010000000000001d4a012100010000000000001d4b012100010000000000001d4c012100010000000000001d4d012100010000000000001d4e012100010000000000001d4f012100010000000000001d50012100010000000000001d51012100010000000000001d52012100010000000000001d53012100010000000000001d54012100010000000000001d55012100010000000000001d56012100010000000000001d57012100010000000000001d58012100010000000000001d59012100010000000000001d5a012100010000000000001d5b012100010000000000001d5c012100010000000000001d5d012100010000000000001d5e012100010000000000001d5f012100010000000000001d60012100010000000000001d61012100010000000000001d62012100010000000000001d63012100010000000000001d64012100010000000000001d65012100010000000000001d66012100010000000000001d67012100010000000000001d68012100010000000000001d69012100010000000000001d6a012100010000000000001d6b012100010000000000001d6c012100010000000000001d6d012100010000000000001d6e012100010000000000001d6f012100010000000000001d70012100010000000000001d71012100010000000000001d72012100010000000000001d73012100010000000000001d74012100010000000000001d75012100010000000000001d76012100010000000000001d77012100010000000000001d78012100010000000000001d79012100010000000000001d7a012100010000000000001d7b012100010000000000001d7c012100010000000000001d7d012100010000000000001d7e012100010000000000001d7f012100010000000000001d80012100010000000000001d81012100010000000000001d82012100010000000000001d83012100010000000000001d84012100010000000000001d85012100010000000000001d86012100010000000000001d87012100010000000000001d88012100010000000000001d89012100010000000000001d8a012100010000000000001d8b012100010000000000001d8c012100010000000000001d8d012100010000000000001d8e012100010000000000001d8f012100010000000000001d90012100010000000000001d91012100010000000000001d92012100010000000000001d93012100010000000000001d94012100010000000000001d95012100010000000000001d96012100010000000000001d97012100010000000000001d98012100010000000000001d99012100010000000000001d9a012100010000000000001d9b012100010000000000001d9c012100010000000000001d9d012100010000000000001d9e012100010000000000001d9f012100010000000000001da0012100010000000000001da1012100010000000000001da2012100010000000000001da3012100010000000000001da4012100010000000000001da5012100010000000000001da6012100010000000000001da7012100010000000000001da8012100010000000000001da9012100010000000000001daa012100010000000000001dab012100010000000000001dac012100010000000000001dad012100010000000000001dae012100010000000000001daf012100010000000000001db0012100010000000000001db1012100010000000000001db2012100010000000000001db3012100010000000000001db4012100010000000000001db5012100010000000000001db6012100010000000000001db7012100010000000000001db8012100010000000000001db9012100010000000000001dba012100010000000000001dbb012100010000000000001dbc012100010000000000001dbd012100010000000000001dbe012100010000000000001dbf012100010000000000001dc0012100010000000000001dc1012100010000000000001dc2012100010000000000001dc3012100010000000000001dc4012100010000000000001dc5012100010000000000001dc6012100010000000000001dc7012100010000000000001dc8012100010000000000001dc9012100010000000000001dca012100010000000000001dcb012100010000000000001dcc012100010000000000001dcd012100010000000000001dce012100010000000000001dcf012100010000000000001dd0012100010000000000001dd1012100010000000000001dd2012100010000000000001dd3012100010000000000001dd4012100010000000000001dd5012100010000000000001dd6012100010000000000001dd7012100010000000000001dd8012100010000000000001dd9012100010000000000001dda012100010000000000001ddb012100010000000000001ddc012100010000000000001ddd012100010000000000001dde012100010000000000001ddf012100010000000000001de0012100010000000000001de1012100010000000000001de2012100010000000000001de3012100010000000000001de4012100010000000000001de5012100010000000000001de6012100010000000000001de7012100010000000000001de8012100010000000000001de9012100010000000000001dea012100010000000000001deb012100010000000000001dec012100010000000000001ded012100010000000000001dee012100010000000000001def012100010000000000001df0012100010000000000001df1012100010000000000001df2012100010000000000001df3012100010000000000001df4012100010000000000001df5012100010000000000001df6012100010000000000001df7012100010000000000001df8012100010000000000001df9012100010000000000001dfa012100010000000000001dfb012100010000000000001dfc012100010000000000001dfd012100010000000000001dfe012100010000000000001dff012100010000000000001e00012100010000000000001e01012100010000000000001e02012100010000000000001e03012100010000000000001e04012100010000000000001e05012100010000000000001e06012100010000000000001e07012100010000000000001e08012100010000000000001e09012100010000000000001e0a012100010000000000001e0b012100010000000000001e0c012100010000000000001e0d012100010000000000001e0e012100010000000000001e0f012100010000000000001e10012100010000000000001e11012100010000000000001e12012100010000000000001e13012100010000000000001e14012100010000000000001e15012100010000000000001e16012100010000000000001e17012100010000000000001e18012100010000000000001e19012100010000000000001e1a012100010000000000001e1b012100010000000000001e1c012100010000000000001e1d012100010000000000001e1e012100010000000000001e1f012100010000000000001e20012100010000000000001e21012100010000000000001e22012100010000000000001e23012100010000000000001e24012100010000000000001e25012100010000000000001e26012100010000000000001e27012100010000000000001e28012100010000000000001e29012100010000000000001e2a012100010000000000001e2b012100010000000000001e2c012100010000000000001e2d012100010000000000001e2e012100010000000000001e2f012100010000000000001e30012100010000000000001e31012100010000000000001e32012100010000000000001e33012100010000000000001e34012100010000000000001e35012100010000000000001e36012100010000000000001e37012100010000000000001e38012100010000000000001e39012100010000000000001e3a012100010000000000001e3b012100010000000000001e3c012100010000000000001e3d012100010000000000001e3e012100010000000000001e3f012100010000000000001e40012100010000000000001e41012100010000000000001e42012100010000000000001e43012100010000000000001e44012100010000000000001e45012100010000000000001e46012100010000000000001e47012100010000000000001e48012100010000000000001e49012100010000000000001e4a012100010000000000001e4b012100010000000000001e4c012100010000000000001e4d012100010000000000001e4e012100010000000000001e4f012100010000000000001e50012100010000000000001e51012100010000000000001e52012100010000000000001e53012100010000000000001e54012100010000000000001e55012100010000000000001e56012100010000000000001e57012100010000000000001e58012100010000000000001e59012100010000000000001e5a012100010000000000001e5b012100010000000000001e5c012100010000000000001e5d012100010000000000001e5e012100010000000000001e5f012100010000000000001e60012100010000000000001e61012100010000000000001e62012100010000000000001e63012100010000000000001e64012100010000000000001e65012100010000000000001e66012100010000000000001e67012100010000000000001e68012100010000000000001e69012100010000000000001e6a012100010000000000001e6b012100010000000000001e6c012100010000000000001e6d012100010000000000001e6e012100010000000000001e6f012100010000000000001e70012100010000000000001e71012100010000000000001e72012100010000000000001e73012100010000000000001e74012100010000000000001e75012100010000000000001e76012100010000000000001e77012100010000000000001e78012100010000000000001e79012100010000000000001e7a012100010000000000001e7b012100010000000000001e7c012100010000000000001e7d012100010000000000001e7e012100010000000000001e7f012100010000000000001e80012100010000000000001e81012100010000000000001e82012100010000000000001e83012100010000000000001e84012100010000000000001e85012100010000000000001e86012100010000000000001e87012100010000000000001e88012100010000000000001e89012100010000000000001e8a012100010000000000001e8b012100010000000000001e8c012100010000000000001e8d012100010000000000001e8e012100010000000000001e8f012100010000000000001e90012100010000000000001e91012100010000000000001e92012100010000000000001e93012100010000000000001e94012100010000000000001e95012100010000000000001e96012100010000000000001e97012100010000000000001e98012100010000000000001e99012100010000000000001e9a012100010000000000001e9b012100010000000000001e9c012100010000000000001e9d012100010000000000001e9e012100010000000000001e9f012100010000000000001ea0012100010000000000001ea1012100010000000000001ea2012100010000000000001ea3012100010000000000001ea4012100010000000000001ea5012100010000000000001ea6012100010000000000001ea7012100010000000000001ea8012100010000000000001ea9012100010000000000001eaa012100010000000000001eab012100010000000000001eac012100010000000000001ead012100010000000000001eae012100010000000000001eaf012100010000000000001eb0012100010000000000001eb1012100010000000000001eb2012100010000000000001eb3012100010000000000001eb4012100010000000000001eb5012100010000000000001eb6012100010000000000001eb7012100010000000000001eb8012100010000000000001eb9012100010000000000001eba012100010000000000001ebb012100010000000000001ebc012100010000000000001ebd012100010000000000001ebe012100010000000000001ebf012100010000000000001ec0012100010000000000001ec1012100010000000000001ec2012100010000000000001ec3012100010000000000001ec4012100010000000000001ec5012100010000000000001ec6012100010000000000001ec7012100010000000000001ec8012100010000000000001ec9012100010000000000001eca012100010000000000001ecb012100010000000000001ecc012100010000000000001ecd012100010000000000001ece012100010000000000001ecf012100010000000000001ed0012100010000000000001ed1012100010000000000001ed2012100010000000000001ed3012100010000000000001ed4012100010000000000001ed5012100010000000000001ed6012100010000000000001ed7012100010000000000001ed8012100010000000000001ed9012100010000000000001eda012100010000000000001edb012100010000000000001edc012100010000000000001edd012100010000000000001ede012100010000000000001edf012100010000000000001ee0012100010000000000001ee1012100010000000000001ee2012100010000000000001ee3012100010000000000001ee4012100010000000000001ee5012100010000000000001ee6012100010000000000001ee7012100010000000000001ee8012100010000000000001ee9012100010000000000001eea012100010000000000001eeb012100010000000000001eec012100010000000000001eed012100010000000000001eee012100010000000000001eef012100010000000000001ef0012100010000000000001ef1012100010000000000001ef2012100010000000000001ef3012100010000000000001ef4012100010000000000001ef5012100010000000000001ef6012100010000000000001ef7012100010000000000001ef8012100010000000000001ef9012100010000000000001efa012100010000000000001efb012100010000000000001efc012100010000000000001efd012100010000000000001efe012100010000000000001eff012100010000000000001f00012100010000000000001f01012100010000000000001f02012100010000000000001f03012100010000000000001f04012100010000000000001f05012100010000000000001f06012100010000000000001f07012100010000000000001f08012100010000000000001f09012100010000000000001f0a012100010000000000001f0b012100010000000000001f0c012100010000000000001f0d012100010000000000001f0e012100010000000000001f0f012100010000000000001f10012100010000000000001f11012100010000000000001f12012100010000000000001f13012100010000000000001f14012100010000000000001f15012100010000000000001f16012100010000000000001f17012100010000000000001f18012100010000000000001f19012100010000000000001f1a012100010000000000001f1b012100010000000000001f1c012100010000000000001f1d012100010000000000001f1e012100010000000000001f1f012100010000000000001f20012100010000000000001f21012100010000000000001f22012100010000000000001f23012100010000000000001f24012100010000000000001f25012100010000000000001f26012100010000000000001f27012100010000000000001f28012100010000000000001f29012100010000000000001f2a012100010000000000001f2b012100010000000000001f2c012100010000000000001f2d012100010000000000001f2e012100010000000000001f2f012100010000000000001f30012100010000000000001f31012100010000000000001f32012100010000000000001f33012100010000000000001f34012100010000000000001f35012100010000000000001f36012100010000000000001f37012100010000000000001f38012100010000000000001f39012100010000000000001f3a012100010000000000001f3b012100010000000000001f3c012100010000000000001f3d012100010000000000001f3e012100010000000000001f3f012100010000000000001f40012100010000000000001f41012100010000000000001f42012100010000000000001f43012100010000000000001f44012100010000000000001f45012100010000000000001f46012100010000000000001f47012100010000000000001f48012100010000000000001f49012100010000000000001f4a012100010000000000001f4b012100010000000000001f4c012100010000000000001f4d012100010000000000001f4e012100010000000000001f4f012100010000000000001f50012100010000000000001f51012100010000000000001f52012100010000000000001f53012100010000000000001f54012100010000000000001f55012100010000000000001f56012100010000000000001f57012100010000000000001f58012100010000000000001f59012100010000000000001f5a012100010000000000001f5b012100010000000000001f5c012100010000000000001f5d012100010000000000001f5e012100010000000000001f5f012100010000000000001f60012100010000000000001f61012100010000000000001f62012100010000000000001f63012100010000000000001f64012100010000000000001f65012100010000000000001f66012100010000000000001f67012100010000000000001f68012100010000000000001f69012100010000000000001f6a012100010000000000001f6b012100010000000000001f6c012100010000000000001f6d012100010000000000001f6e012100010000000000001f6f012100010000000000001f70012100010000000000001f71012100010000000000001f72012100010000000000001f73012100010000000000001f74012100010000000000001f75012100010000000000001f76012100010000000000001f77012100010000000000001f78012100010000000000001f79012100010000000000001f7a012100010000000000001f7b012100010000000000001f7c012100010000000000001f7d012100010000000000001f7e012100010000000000001f7f012100010000000000001f80012100010000000000001f81012100010000000000001f82012100010000000000001f83012100010000000000001f84012100010000000000001f85012100010000000000001f86012100010000000000001f87012100010000000000001f88012100010000000000001f89012100010000000000001f8a012100010000000000001f8b012100010000000000001f8c012100010000000000001f8d012100010000000000001f8e012100010000000000001f8f012100010000000000001f90012100010000000000001f91012100010000000000001f92012100010000000000001f93012100010000000000001f94012100010000000000001f95012100010000000000001f96012100010000000000001f97012100010000000000001f98012100010000000000001f99012100010000000000001f9a012100010000000000001f9b012100010000000000001f9c012100010000000000001f9d012100010000000000001f9e012100010000000000001f9f012100010000000000001fa0012100010000000000001fa1012100010000000000001fa2012100010000000000001fa3012100010000000000001fa4012100010000000000001fa5012100010000000000001fa6012100010000000000001fa7012100010000000000001fa8012100010000000000001fa9012100010000000000001faa012100010000000000001fab012100010000000000001fac012100010000000000001fad012100010000000000001fae012100010000000000001faf012100010000000000001fb0012100010000000000001fb1012100010000000000001fb2012100010000000000001fb3012100010000000000001fb4012100010000000000001fb5012100010000000000001fb6012100010000000000001fb7012100010000000000001fb8012100010000000000001fb9012100010000000000001fba012100010000000000001fbb012100010000000000001fbc012100010000000000001fbd012100010000000000001fbe012100010000000000001fbf012100010000000000001fc0012100010000000000001fc1012100010000000000001fc2012100010000000000001fc3012100010000000000001fc4012100010000000000001fc5012100010000000000001fc6012100010000000000001fc7012100010000000000001fc8012100010000000000001fc9012100010000000000001fca012100010000000000001fcb012100010000000000001fcc012100010000000000001fcd012100010000000000001fce012100010000000000001fcf012100010000000000001fd0012100010000000000001fd1012100010000000000001fd2012100010000000000001fd3012100010000000000001fd4012100010000000000001fd5012100010000000000001fd6012100010000000000001fd7012100010000000000001fd8012100010000000000001fd9012100010000000000001fda012100010000000000001fdb012100010000000000001fdc012100010000000000001fdd012100010000000000001fde012100010000000000001fdf012100010000000000001fe0012100010000000000001fe1012100010000000000001fe2012100010000000000001fe3012100010000000000001fe4012100010000000000001fe5012100010000000000001fe6012100010000000000001fe7012100010000000000001fe8012100010000000000001fe9012100010000000000001fea012100010000000000001feb012100010000000000001fec012100010000000000001fed012100010000000000001fee012100010000000000001fef012100010000000000001ff0012100010000000000001ff1012100010000000000001ff2012100010000000000001ff3012100010000000000001ff4012100010000000000001ff5012100010000000000001ff6012100010000000000001ff7012100010000000000001ff8012100010000000000001ff9012100010000000000001ffa012100010000000000001ffb012100010000000000001ffc012100010000000000001ffd012100010000000000001ffe012100010000000000001fff01210001000000000000200001210001000000000000200101210001000000000000200201210001000000000000200301210001000000000000200401210001000000000000200501210001000000000000200601210001000000000000200701210001000000000000200801210001000000000000200901210001000000000000200a01210001000000000000200b01210001000000000000200c01210001000000000000200d01210001000000000000200e01210001000000000000200f01210001000000000000201001210001000000000000201101210001000000000000201201210001000000000000201301210001000000000000201401210001000000000000201501210001000000000000201601210001000000000000201701210001000000000000201801210001000000000000201901210001000000000000201a01210001000000000000201b01210001000000000000201c01210001000000000000201d01210001000000000000201e01210001000000000000201f01210001000000000000202001210001000000000000202101210001000000000000202201210001000000000000202301210001000000000000202401210001000000000000202501210001000000000000202601210001000000000000202701210001000000000000202801210001000000000000202901210001000000000000202a01210001000000000000202b01210001000000000000202c01210001000000000000202d01210001000000000000202e01210001000000000000202f01210001000000000000203001210001000000000000203101210001000000000000203201210001000000000000203301210001000000000000203401210001000000000000203501210001000000000000203601210001000000000000203701210001000000000000203801210001000000000000203901210001000000000000203a01210001000000000000203b01210001000000000000203c01210001000000000000203d01210001000000000000203e01210001000000000000203f01210001000000000000204001210001000000000000204101210001000000000000204201210001000000000000204301210001000000000000204401210001000000000000204501210001000000000000204601210001000000000000204701210001000000000000204801210001000000000000204901210001000000000000204a01210001000000000000204b01210001000000000000204c01210001000000000000204d01210001000000000000204e01210001000000000000204f01210001000000000000205001210001000000000000205101210001000000000000205201210001000000000000205301210001000000000000205401210001000000000000205501210001000000000000205601210001000000000000205701210001000000000000205801210001000000000000205901210001000000000000205a01210001000000000000205b01210001000000000000205c01210001000000000000205d01210001000000000000205e01210001000000000000205f01210001000000000000206001210001000000000000206101210001000000000000206201210001000000000000206301210001000000000000206401210001000000000000206501210001000000000000206601210001000000000000206701210001000000000000206801210001000000000000206901210001000000000000206a01210001000000000000206b01210001000000000000206c01210001000000000000206d01210001000000000000206e01210001000000000000206f01210001000000000000207001210001000000000000207101210001000000000000207201210001000000000000207301210001000000000000207401210001000000000000207501210001000000000000207601210001000000000000207701210001000000000000207801210001000000000000207901210001000000000000207a01210001000000000000207b01210001000000000000207c01210001000000000000207d01210001000000000000207e01210001000000000000207f01210001000000000000208001210001000000000000208101210001000000000000208201210001000000000000208301210001000000000000208401210001000000000000208501210001000000000000208601210001000000000000208701210001000000000000208801210001000000000000208901210001000000000000208a01210001000000000000208b01210001000000000000208c01210001000000000000208d01210001000000000000208e01210001000000000000208f01210001000000000000209001210001000000000000209101210001000000000000209201210001000000000000209301210001000000000000209401210001000000000000209501210001000000000000209601210001000000000000209701210001000000000000209801210001000000000000209901210001000000000000209a01210001000000000000209b01210001000000000000209c01210001000000000000209d01210001000000000000209e01210001000000000000209f0121000100000000000020a00121000100000000000020a10121000100000000000020a20121000100000000000020a30121000100000000000020a40121000100000000000020a50121000100000000000020a60121000100000000000020a70121000100000000000020a80121000100000000000020a90121000100000000000020aa0121000100000000000020ab0121000100000000000020ac0121000100000000000020ad0121000100000000000020ae0121000100000000000020af0121000100000000000020b00121000100000000000020b10121000100000000000020b20121000100000000000020b30121000100000000000020b40121000100000000000020b50121000100000000000020b60121000100000000000020b70121000100000000000020b80121000100000000000020b90121000100000000000020ba0121000100000000000020bb0121000100000000000020bc0121000100000000000020bd0121000100000000000020be0121000100000000000020bf0121000100000000000020c00121000100000000000020c10121000100000000000020c20121000100000000000020c30121000100000000000020c40121000100000000000020c50121000100000000000020c60121000100000000000020c70121000100000000000020c80121000100000000000020c90121000100000000000020ca0121000100000000000020cb0121000100000000000020cc0121000100000000000020cd0121000100000000000020ce0121000100000000000020cf0121000100000000000020d00121000100000000000020d10121000100000000000020d20121000100000000000020d30121000100000000000020d40121000100000000000020d50121000100000000000020d60121000100000000000020d70121000100000000000020d80121000100000000000020d90121000100000000000020da0121000100000000000020db0121000100000000000020dc0121000100000000000020dd0121000100000000000020de0121000100000000000020df0121000100000000000020e00121000100000000000020e10121000100000000000020e20121000100000000000020e30121000100000000000020e40121000100000000000020e50121000100000000000020e60121000100000000000020e70121000100000000000020e80121000100000000000020e90121000100000000000020ea0121000100000000000020eb0121000100000000000020ec0121000100000000000020ed0121000100000000000020ee0121000100000000000020ef0121000100000000000020f00121000100000000000020f10121000100000000000020f20121000100000000000020f30121000100000000000020f40121000100000000000020f50121000100000000000020f60121000100000000000020f70121000100000000000020f80121000100000000000020f90121000100000000000020fa0121000100000000000020fb0121000100000000000020fc0121000100000000000020fd0121000100000000000020fe0121000100000000000020ff01210001000000000000210001210001000000000000210101210001000000000000210201210001000000000000210301210001000000000000210401210001000000000000210501210001000000000000210601210001000000000000210701210001000000000000210801210001000000000000210901210001000000000000210a01210001000000000000210b01210001000000000000210c01210001000000000000210d01210001000000000000210e01210001000000000000210f01210001000000000000211001210001000000000000211101210001000000000000211201210001000000000000211301210001000000000000211401210001000000000000211501210001000000000000211601210001000000000000211701210001000000000000211801210001000000000000211901210001000000000000211a01210001000000000000211b01210001000000000000211c01210001000000000000211d01210001000000000000211e01210001000000000000211f01210001000000000000212001210001000000000000212101210001000000000000212201210001000000000000212301210001000000000000212401210001000000000000212501210001000000000000212601210001000000000000212701210001000000000000212801210001000000000000212901210001000000000000212a01210001000000000000212b01210001000000000000212c01210001000000000000212d01210001000000000000212e01210001000000000000212f01210001000000000000213001210001000000000000213101210001000000000000213201210001000000000000213301210001000000000000213401210001000000000000213501210001000000000000213601210001000000000000213701210001000000000000213801210001000000000000213901210001000000000000213a01210001000000000000213b01210001000000000000213c01210001000000000000213d01210001000000000000213e01210001000000000000213f01210001000000000000214001210001000000000000214101210001000000000000214201210001000000000000214301210001000000000000214401210001000000000000214501210001000000000000214601210001000000000000214701210001000000000000214801210001000000000000214901210001000000000000214a01210001000000000000214b01210001000000000000214c01210001000000000000214d01210001000000000000214e01210001000000000000214f01210001000000000000215001210001000000000000215101210001000000000000215201210001000000000000215301210001000000000000215401210001000000000000215501210001000000000000215601210001000000000000215701210001000000000000215801210001000000000000215901210001000000000000215a01210001000000000000215b01210001000000000000215c01210001000000000000215d01210001000000000000215e01210001000000000000215f01210001000000000000216001210001000000000000216101210001000000000000216201210001000000000000216301210001000000000000216401210001000000000000216501210001000000000000216601210001000000000000216701210001000000000000216801210001000000000000216901210001000000000000216a01210001000000000000216b01210001000000000000216c01210001000000000000216d01210001000000000000216e01210001000000000000216f01210001000000000000217001210001000000000000217101210001000000000000217201210001000000000000217301210001000000000000217401210001000000000000217501210001000000000000217601210001000000000000217701210001000000000000217801210001000000000000217901210001000000000000217a01210001000000000000217b01210001000000000000217c01210001000000000000217d01210001000000000000217e01210001000000000000217f01210001000000000000218001210001000000000000218101210001000000000000218201210001000000000000218301210001000000000000218401210001000000000000218501210001000000000000218601210001000000000000218701210001000000000000218801210001000000000000218901210001000000000000218a01210001000000000000218b01210001000000000000218c01210001000000000000218d01210001000000000000218e01210001000000000000218f01210001000000000000219001210001000000000000219101210001000000000000219201210001000000000000219301210001000000000000219401210001000000000000219501210001000000000000219601210001000000000000219701210001000000000000219801210001000000000000219901210001000000000000219a01210001000000000000219b01210001000000000000219c01210001000000000000219d01210001000000000000219e01210001000000000000219f0121000100000000000021a00121000100000000000021a10121000100000000000021a20121000100000000000021a30121000100000000000021a40121000100000000000021a50121000100000000000021a60121000100000000000021a70121000100000000000021a80121000100000000000021a90121000100000000000021aa0121000100000000000021ab0121000100000000000021ac0121000100000000000021ad0121000100000000000021ae0121000100000000000021af0121000100000000000021b00121000100000000000021b10121000100000000000021b20121000100000000000021b30121000100000000000021b40121000100000000000021b50121000100000000000021b60121000100000000000021b70121000100000000000021b80121000100000000000021b90121000100000000000021ba0121000100000000000021bb0121000100000000000021bc0121000100000000000021bd0121000100000000000021be0121000100000000000021bf0121000100000000000021c00121000100000000000021c10121000100000000000021c20121000100000000000021c30121000100000000000021c40121000100000000000021c50121000100000000000021c60121000100000000000021c70121000100000000000021c80121000100000000000021c90121000100000000000021ca0121000100000000000021cb0121000100000000000021cc0121000100000000000021cd0121000100000000000021ce0121000100000000000021cf0121000100000000000021d00121000100000000000021d10121000100000000000021d20121000100000000000021d30121000100000000000021d40121000100000000000021d50121000100000000000021d60121000100000000000021d70121000100000000000021d80121000100000000000021d90121000100000000000021da0121000100000000000021db0121000100000000000021dc0121000100000000000021dd0121000100000000000021de0121000100000000000021df0121000100000000000021e00121000100000000000021e10121000100000000000021e20121000100000000000021e30121000100000000000021e40121000100000000000021e50121000100000000000021e60121000100000000000021e70121000100000000000021e80121000100000000000021e90121000100000000000021ea0121000100000000000021eb0121000100000000000021ec0121000100000000000021ed0121000100000000000021ee0121000100000000000021ef0121000100000000000021f00121000100000000000021f10121000100000000000021f20121000100000000000021f30121000100000000000021f40121000100000000000021f50121000100000000000021f60121000100000000000021f70121000100000000000021f80121000100000000000021f90121000100000000000021fa0121000100000000000021fb0121000100000000000021fc0121000100000000000021fd0121000100000000000021fe0121000100000000000021ff01210001000000000000220001210001000000000000220101210001000000000000220201210001000000000000220301210001000000000000220401210001000000000000220501210001000000000000220601210001000000000000220701210001000000000000220801210001000000000000220901210001000000000000220a01210001000000000000220b01210001000000000000220c01210001000000000000220d01210001000000000000220e01210001000000000000220f01210001000000000000221001210001000000000000221101210001000000000000221201210001000000000000221301210001000000000000221401210001000000000000221501210001000000000000221601210001000000000000221701210001000000000000221801210001000000000000221901210001000000000000221a01210001000000000000221b01210001000000000000221c01210001000000000000221d01210001000000000000221e01210001000000000000221f01210001000000000000222001210001000000000000222101210001000000000000222201210001000000000000222301210001000000000000222401210001000000000000222501210001000000000000222601210001000000000000222701210001000000000000222801210001000000000000222901210001000000000000222a01210001000000000000222b01210001000000000000222c01210001000000000000222d01210001000000000000222e01210001000000000000222f01210001000000000000223001210001000000000000223101210001000000000000223201210001000000000000223301210001000000000000223401210001000000000000223501210001000000000000223601210001000000000000223701210001000000000000223801210001000000000000223901210001000000000000223a01210001000000000000223b01210001000000000000223c01210001000000000000223d01210001000000000000223e01210001000000000000223f01210001000000000000224001210001000000000000224101210001000000000000224201210001000000000000224301210001000000000000224401210001000000000000224501210001000000000000224601210001000000000000224701210001000000000000224801210001000000000000224901210001000000000000224a01210001000000000000224b01210001000000000000224c01210001000000000000224d01210001000000000000224e01210001000000000000224f01210001000000000000225001210001000000000000225101210001000000000000225201210001000000000000225301210001000000000000225401210001000000000000225501210001000000000000225601210001000000000000225701210001000000000000225801210001000000000000225901210001000000000000225a01210001000000000000225b01210001000000000000225c01210001000000000000225d01210001000000000000225e01210001000000000000225f01210001000000000000226001210001000000000000226101210001000000000000226201210001000000000000226301210001000000000000226401210001000000000000226501210001000000000000226601210001000000000000226701210001000000000000226801210001000000000000226901210001000000000000226a01210001000000000000226b01210001000000000000226c01210001000000000000226d01210001000000000000226e01210001000000000000226f01210001000000000000227001210001000000000000227101210001000000000000227201210001000000000000227301210001000000000000227401210001000000000000227501210001000000000000227601210001000000000000227701210001000000000000227801210001000000000000227901210001000000000000227a01210001000000000000227b01210001000000000000227c01210001000000000000227d01210001000000000000227e01210001000000000000227f01210001000000000000228001210001000000000000228101210001000000000000228201210001000000000000228301210001000000000000228401210001000000000000228501210001000000000000228601210001000000000000228701210001000000000000228801210001000000000000228901210001000000000000228a01210001000000000000228b01210001000000000000228c01210001000000000000228d01210001000000000000228e01210001000000000000228f01210001000000000000229001210001000000000000229101210001000000000000229201210001000000000000229301210001000000000000229401210001000000000000229501210001000000000000229601210001000000000000229701210001000000000000229801210001000000000000229901210001000000000000229a01210001000000000000229b01210001000000000000229c01210001000000000000229d01210001000000000000229e01210001000000000000229f0121000100000000000022a00121000100000000000022a10121000100000000000022a20121000100000000000022a30121000100000000000022a40121000100000000000022a50121000100000000000022a60121000100000000000022a70121000100000000000022a80121000100000000000022a90121000100000000000022aa0121000100000000000022ab0121000100000000000022ac0121000100000000000022ad0121000100000000000022ae0121000100000000000022af0121000100000000000022b00121000100000000000022b10121000100000000000022b20121000100000000000022b30121000100000000000022b40121000100000000000022b50121000100000000000022b60121000100000000000022b70121000100000000000022b80121000100000000000022b90121000100000000000022ba0121000100000000000022bb0121000100000000000022bc0121000100000000000022bd0121000100000000000022be0121000100000000000022bf0121000100000000000022c00121000100000000000022c10121000100000000000022c20121000100000000000022c30121000100000000000022c40121000100000000000022c50121000100000000000022c60121000100000000000022c70121000100000000000022c80121000100000000000022c90121000100000000000022ca0121000100000000000022cb0121000100000000000022cc0121000100000000000022cd0121000100000000000022ce0121000100000000000022cf0121000100000000000022d00121000100000000000022d10121000100000000000022d20121000100000000000022d30121000100000000000022d40121000100000000000022d50121000100000000000022d60121000100000000000022d70121000100000000000022d80121000100000000000022d90121000100000000000022da0121000100000000000022db0121000100000000000022dc0121000100000000000022dd0121000100000000000022de0121000100000000000022df0121000100000000000022e00121000100000000000022e10121000100000000000022e20121000100000000000022e30121000100000000000022e40121000100000000000022e50121000100000000000022e60121000100000000000022e70121000100000000000022e80121000100000000000022e90121000100000000000022ea0121000100000000000022eb0121000100000000000022ec0121000100000000000022ed0121000100000000000022ee0121000100000000000022ef0121000100000000000022f00121000100000000000022f10121000100000000000022f20121000100000000000022f30121000100000000000022f40121000100000000000022f50121000100000000000022f60121000100000000000022f70121000100000000000022f80121000100000000000022f90121000100000000000022fa0121000100000000000022fb0121000100000000000022fc0121000100000000000022fd0121000100000000000022fe0121000100000000000022ff01210001000000000000230001210001000000000000230101210001000000000000230201210001000000000000230301210001000000000000230401210001000000000000230501210001000000000000230601210001000000000000230701210001000000000000230801210001000000000000230901210001000000000000230a01210001000000000000230b01210001000000000000230c01210001000000000000230d01210001000000000000230e01210001000000000000230f01210001000000000000231001210001000000000000231101210001000000000000231201210001000000000000231301210001000000000000231401210001000000000000231501210001000000000000231601210001000000000000231701210001000000000000231801210001000000000000231901210001000000000000231a01210001000000000000231b01210001000000000000231c01210001000000000000231d01210001000000000000231e01210001000000000000231f01210001000000000000232001210001000000000000232101210001000000000000232201210001000000000000232301210001000000000000232401210001000000000000232501210001000000000000232601210001000000000000232701210001000000000000232801210001000000000000232901210001000000000000232a01210001000000000000232b01210001000000000000232c01210001000000000000232d01210001000000000000232e01210001000000000000232f01210001000000000000233001210001000000000000233101210001000000000000233201210001000000000000233301210001000000000000233401210001000000000000233501210001000000000000233601210001000000000000233701210001000000000000233801210001000000000000233901210001000000000000233a01210001000000000000233b01210001000000000000233c01210001000000000000233d01210001000000000000233e01210001000000000000233f01210001000000000000234001210001000000000000234101210001000000000000234201210001000000000000234301210001000000000000234401210001000000000000234501210001000000000000234601210001000000000000234701210001000000000000234801210001000000000000234901210001000000000000234a01210001000000000000234b01210001000000000000234c01210001000000000000234d01210001000000000000234e01210001000000000000234f01210001000000000000235001210001000000000000235101210001000000000000235201210001000000000000235301210001000000000000235401210001000000000000235501210001000000000000235601210001000000000000235701210001000000000000235801210001000000000000235901210001000000000000235a01210001000000000000235b01210001000000000000235c01210001000000000000235d01210001000000000000235e01210001000000000000235f01210001000000000000236001210001000000000000236101210001000000000000236201210001000000000000236301210001000000000000236401210001000000000000236501210001000000000000236601210001000000000000236701210001000000000000236801210001000000000000236901210001000000000000236a01210001000000000000236b01210001000000000000236c01210001000000000000236d01210001000000000000236e01210001000000000000236f01210001000000000000237001210001000000000000237101210001000000000000237201210001000000000000237301210001000000000000237401210001000000000000237501210001000000000000237601210001000000000000237701210001000000000000237801210001000000000000237901210001000000000000237a01210001000000000000237b01210001000000000000237c01210001000000000000237d01210001000000000000237e01210001000000000000237f01210001000000000000238001210001000000000000238101210001000000000000238201210001000000000000238301210001000000000000238401210001000000000000238501210001000000000000238601210001000000000000238701210001000000000000238801210001000000000000238901210001000000000000238a01210001000000000000238b01210001000000000000238c01210001000000000000238d01210001000000000000238e01210001000000000000238f01210001000000000000239001210001000000000000239101210001000000000000239201210001000000000000239301210001000000000000239401210001000000000000239501210001000000000000239601210001000000000000239701210001000000000000239801210001000000000000239901210001000000000000239a01210001000000000000239b01210001000000000000239c01210001000000000000239d01210001000000000000239e01210001000000000000239f0121000100000000000023a00121000100000000000023a10121000100000000000023a20121000100000000000023a30121000100000000000023a40121000100000000000023a50121000100000000000023a60121000100000000000023a70121000100000000000023a80121000100000000000023a90121000100000000000023aa0121000100000000000023ab0121000100000000000023ac0121000100000000000023ad0121000100000000000023ae0121000100000000000023af0121000100000000000023b00121000100000000000023b10121000100000000000023b20121000100000000000023b30121000100000000000023b40121000100000000000023b50121000100000000000023b60121000100000000000023b70121000100000000000023b80121000100000000000023b90121000100000000000023ba0121000100000000000023bb0121000100000000000023bc0121000100000000000023bd0121000100000000000023be0121000100000000000023bf0121000100000000000023c00121000100000000000023c10121000100000000000023c20121000100000000000023c30121000100000000000023c40121000100000000000023c50121000100000000000023c60121000100000000000023c70121000100000000000023c80121000100000000000023c90121000100000000000023ca0121000100000000000023cb0121000100000000000023cc0121000100000000000023cd0121000100000000000023ce0121000100000000000023cf0121000100000000000023d00121000100000000000023d10121000100000000000023d20121000100000000000023d30121000100000000000023d40121000100000000000023d50121000100000000000023d60121000100000000000023d70121000100000000000023d80121000100000000000023d90121000100000000000023da0121000100000000000023db0121000100000000000023dc0121000100000000000023dd0121000100000000000023de0121000100000000000023df0121000100000000000023e00121000100000000000023e10121000100000000000023e20121000100000000000023e30121000100000000000023e40121000100000000000023e50121000100000000000023e60121000100000000000023e70121000100000000000023e80121000100000000000023e90121000100000000000023ea0121000100000000000023eb0121000100000000000023ec0121000100000000000023ed0121000100000000000023ee0121000100000000000023ef0121000100000000000023f00121000100000000000023f10121000100000000000023f20121000100000000000023f30121000100000000000023f40121000100000000000023f50121000100000000000023f60121000100000000000023f70121000100000000000023f80121000100000000000023f90121000100000000000023fa0121000100000000000023fb0121000100000000000023fc0121000100000000000023fd0121000100000000000023fe0121000100000000000023ff01210001000000000000240001210001000000000000240101210001000000000000240201210001000000000000240301210001000000000000240401210001000000000000240501210001000000000000240601210001000000000000240701210001000000000000240801210001000000000000240901210001000000000000240a01210001000000000000240b01210001000000000000240c01210001000000000000240d01210001000000000000240e01210001000000000000240f01210001000000000000241001210001000000000000241101210001000000000000241201210001000000000000241301210001000000000000241401210001000000000000241501210001000000000000241601210001000000000000241701210001000000000000241801210001000000000000241901210001000000000000241a01210001000000000000241b01210001000000000000241c01210001000000000000241d01210001000000000000241e01210001000000000000241f01210001000000000000242001210001000000000000242101210001000000000000242201210001000000000000242301210001000000000000242401210001000000000000242501210001000000000000242601210001000000000000242701210001000000000000242801210001000000000000242901210001000000000000242a01210001000000000000242b01210001000000000000242c01210001000000000000242d01210001000000000000242e01210001000000000000242f01210001000000000000243001210001000000000000243101210001000000000000243201210001000000000000243301210001000000000000243401210001000000000000243501210001000000000000243601210001000000000000243701210001000000000000243801210001000000000000243901210001000000000000243a01210001000000000000243b01210001000000000000243c01210001000000000000243d01210001000000000000243e01210001000000000000243f01210001000000000000244001210001000000000000244101210001000000000000244201210001000000000000244301210001000000000000244401210001000000000000244501210001000000000000244601210001000000000000244701210001000000000000244801210001000000000000244901210001000000000000244a01210001000000000000244b01210001000000000000244c01210001000000000000244d01210001000000000000244e01210001000000000000244f01210001000000000000245001210001000000000000245101210001000000000000245201210001000000000000245301210001000000000000245401210001000000000000245501210001000000000000245601210001000000000000245701210001000000000000245801210001000000000000245901210001000000000000245a01210001000000000000245b01210001000000000000245c01210001000000000000245d01210001000000000000245e01210001000000000000245f01210001000000000000246001210001000000000000246101210001000000000000246201210001000000000000246301210001000000000000246401210001000000000000246501210001000000000000246601210001000000000000246701210001000000000000246801210001000000000000246901210001000000000000246a01210001000000000000246b01210001000000000000246c01210001000000000000246d01210001000000000000246e01210001000000000000246f01210001000000000000247001210001000000000000247101210001000000000000247201210001000000000000247301210001000000000000247401210001000000000000247501210001000000000000247601210001000000000000247701210001000000000000247801210001000000000000247901210001000000000000247a01210001000000000000247b01210001000000000000247c01210001000000000000247d01210001000000000000247e01210001000000000000247f01210001000000000000248001210001000000000000248101210001000000000000248201210001000000000000248301210001000000000000248401210001000000000000248501210001000000000000248601210001000000000000248701210001000000000000248801210001000000000000248901210001000000000000248a01210001000000000000248b01210001000000000000248c01210001000000000000248d01210001000000000000248e01210001000000000000248f01210001000000000000249001210001000000000000249101210001000000000000249201210001000000000000249301210001000000000000249401210001000000000000249501210001000000000000249601210001000000000000249701210001000000000000249801210001000000000000249901210001000000000000249a01210001000000000000249b01210001000000000000249c01210001000000000000249d01210001000000000000249e01210001000000000000249f0121000100000000000024a00121000100000000000024a10121000100000000000024a20121000100000000000024a30121000100000000000024a40121000100000000000024a50121000100000000000024a60121000100000000000024a70121000100000000000024a80121000100000000000024a90121000100000000000024aa0121000100000000000024ab0121000100000000000024ac0121000100000000000024ad0121000100000000000024ae0121000100000000000024af0121000100000000000024b00121000100000000000024b10121000100000000000024b20121000100000000000024b30121000100000000000024b40121000100000000000024b50121000100000000000024b60121000100000000000024b70121000100000000000024b80121000100000000000024b90121000100000000000024ba0121000100000000000024bb0121000100000000000024bc0121000100000000000024bd0121000100000000000024be0121000100000000000024bf0121000100000000000024c00121000100000000000024c10121000100000000000024c20121000100000000000024c30121000100000000000024c40121000100000000000024c50121000100000000000024c60121000100000000000024c70121000100000000000024c80121000100000000000024c90121000100000000000024ca0121000100000000000024cb0121000100000000000024cc0121000100000000000024cd0121000100000000000024ce0121000100000000000024cf0121000100000000000024d00121000100000000000024d10121000100000000000024d20121000100000000000024d30121000100000000000024d40121000100000000000024d50121000100000000000024d60121000100000000000024d70121000100000000000024d80121000100000000000024d90121000100000000000024da0121000100000000000024db0121000100000000000024dc0121000100000000000024dd0121000100000000000024de0121000100000000000024df0121000100000000000024e00121000100000000000024e10121000100000000000024e20121000100000000000024e30121000100000000000024e40121000100000000000024e50121000100000000000024e60121000100000000000024e70121000100000000000024e80121000100000000000024e90121000100000000000024ea0121000100000000000024eb0121000100000000000024ec0121000100000000000024ed0121000100000000000024ee0121000100000000000024ef0121000100000000000024f00121000100000000000024f10121000100000000000024f20121000100000000000024f30121000100000000000024f40121000100000000000024f50121000100000000000024f60121000100000000000024f70121000100000000000024f80121000100000000000024f90121000100000000000024fa0121000100000000000024fb0121000100000000000024fc0121000100000000000024fd0121000100000000000024fe0121000100000000000024ff01210001000000000000250001210001000000000000250101210001000000000000250201210001000000000000250301210001000000000000250401210001000000000000250501210001000000000000250601210001000000000000250701210001000000000000250801210001000000000000250901210001000000000000250a01210001000000000000250b01210001000000000000250c01210001000000000000250d01210001000000000000250e01210001000000000000250f01210001000000000000251001210001000000000000251101210001000000000000251201210001000000000000251301210001000000000000251401210001000000000000251501210001000000000000251601210001000000000000251701210001000000000000251801210001000000000000251901210001000000000000251a01210001000000000000251b01210001000000000000251c01210001000000000000251d01210001000000000000251e01210001000000000000251f01210001000000000000252001210001000000000000252101210001000000000000252201210001000000000000252301210001000000000000252401210001000000000000252501210001000000000000252601210001000000000000252701210001000000000000252801210001000000000000252901210001000000000000252a01210001000000000000252b01210001000000000000252c01210001000000000000252d01210001000000000000252e01210001000000000000252f01210001000000000000253001210001000000000000253101210001000000000000253201210001000000000000253301210001000000000000253401210001000000000000253501210001000000000000253601210001000000000000253701210001000000000000253801210001000000000000253901210001000000000000253a01210001000000000000253b01210001000000000000253c01210001000000000000253d01210001000000000000253e01210001000000000000253f01210001000000000000254001210001000000000000254101210001000000000000254201210001000000000000254301210001000000000000254401210001000000000000254501210001000000000000254601210001000000000000254701210001000000000000254801210001000000000000254901210001000000000000254a01210001000000000000254b01210001000000000000254c01210001000000000000254d01210001000000000000254e01210001000000000000254f01210001000000000000255001210001000000000000255101210001000000000000255201210001000000000000255301210001000000000000255401210001000000000000255501210001000000000000255601210001000000000000255701210001000000000000255801210001000000000000255901210001000000000000255a01210001000000000000255b01210001000000000000255c01210001000000000000255d01210001000000000000255e01210001000000000000255f01210001000000000000256001210001000000000000256101210001000000000000256201210001000000000000256301210001000000000000256401210001000000000000256501210001000000000000256601210001000000000000256701210001000000000000256801210001000000000000256901210001000000000000256a01210001000000000000256b01210001000000000000256c01210001000000000000256d01210001000000000000256e01210001000000000000256f01210001000000000000257001210001000000000000257101210001000000000000257201210001000000000000257301210001000000000000257401210001000000000000257501210001000000000000257601210001000000000000257701210001000000000000257801210001000000000000257901210001000000000000257a01210001000000000000257b01210001000000000000257c01210001000000000000257d01210001000000000000257e01210001000000000000257f01210001000000000000258001210001000000000000258101210001000000000000258201210001000000000000258301210001000000000000258401210001000000000000258501210001000000000000258601210001000000000000258701210001000000000000258801210001000000000000258901210001000000000000258a01210001000000000000258b01210001000000000000258c01210001000000000000258d01210001000000000000258e01210001000000000000258f01210001000000000000259001210001000000000000259101210001000000000000259201210001000000000000259301210001000000000000259401210001000000000000259501210001000000000000259601210001000000000000259701210001000000000000259801210001000000000000259901210001000000000000259a01210001000000000000259b01210001000000000000259c01210001000000000000259d01210001000000000000259e01210001000000000000259f0121000100000000000025a00121000100000000000025a10121000100000000000025a20121000100000000000025a30121000100000000000025a40121000100000000000025a50121000100000000000025a60121000100000000000025a70121000100000000000025a80121000100000000000025a90121000100000000000025aa0121000100000000000025ab0121000100000000000025ac0121000100000000000025ad0121000100000000000025ae0121000100000000000025af0121000100000000000025b00121000100000000000025b10121000100000000000025b20121000100000000000025b30121000100000000000025b40121000100000000000025b50121000100000000000025b60121000100000000000025b70121000100000000000025b80121000100000000000025b90121000100000000000025ba0121000100000000000025bb0121000100000000000025bc0121000100000000000025bd0121000100000000000025be0121000100000000000025bf0121000100000000000025c00121000100000000000025c10121000100000000000025c20121000100000000000025c30121000100000000000025c40121000100000000000025c50121000100000000000025c60121000100000000000025c70121000100000000000025c80121000100000000000025c90121000100000000000025ca0121000100000000000025cb0121000100000000000025cc0121000100000000000025cd0121000100000000000025ce0121000100000000000025cf0121000100000000000025d00121000100000000000025d10121000100000000000025d20121000100000000000025d30121000100000000000025d40121000100000000000025d50121000100000000000025d60121000100000000000025d70121000100000000000025d80121000100000000000025d90121000100000000000025da0121000100000000000025db0121000100000000000025dc0121000100000000000025dd0121000100000000000025de0121000100000000000025df0121000100000000000025e00121000100000000000025e10121000100000000000025e20121000100000000000025e30121000100000000000025e40121000100000000000025e50121000100000000000025e60121000100000000000025e70121000100000000000025e80121000100000000000025e90121000100000000000025ea0121000100000000000025eb0121000100000000000025ec0121000100000000000025ed0121000100000000000025ee0121000100000000000025ef0121000100000000000025f00121000100000000000025f10121000100000000000025f20121000100000000000025f30121000100000000000025f40121000100000000000025f50121000100000000000025f60121000100000000000025f70121000100000000000025f80121000100000000000025f90121000100000000000025fa0121000100000000000025fb0121000100000000000025fc0121000100000000000025fd0121000100000000000025fe0121000100000000000025ff01210001000000000000260001210001000000000000260101210001000000000000260201210001000000000000260301210001000000000000260401210001000000000000260501210001000000000000260601210001000000000000260701210001000000000000260801210001000000000000260901210001000000000000260a01210001000000000000260b01210001000000000000260c01210001000000000000260d01210001000000000000260e01210001000000000000260f01210001000000000000261001210001000000000000261101210001000000000000261201210001000000000000261301210001000000000000261401210001000000000000261501210001000000000000261601210001000000000000261701210001000000000000261801210001000000000000261901210001000000000000261a01210001000000000000261b01210001000000000000261c01210001000000000000261d01210001000000000000261e01210001000000000000261f01210001000000000000262001210001000000000000262101210001000000000000262201210001000000000000262301210001000000000000262401210001000000000000262501210001000000000000262601210001000000000000262701210001000000000000262801210001000000000000262901210001000000000000262a01210001000000000000262b01210001000000000000262c01210001000000000000262d01210001000000000000262e01210001000000000000262f01210001000000000000263001210001000000000000263101210001000000000000263201210001000000000000263301210001000000000000263401210001000000000000263501210001000000000000263601210001000000000000263701210001000000000000263801210001000000000000263901210001000000000000263a01210001000000000000263b01210001000000000000263c01210001000000000000263d01210001000000000000263e01210001000000000000263f01210001000000000000264001210001000000000000264101210001000000000000264201210001000000000000264301210001000000000000264401210001000000000000264501210001000000000000264601210001000000000000264701210001000000000000264801210001000000000000264901210001000000000000264a01210001000000000000264b01210001000000000000264c01210001000000000000264d01210001000000000000264e01210001000000000000264f01210001000000000000265001210001000000000000265101210001000000000000265201210001000000000000265301210001000000000000265401210001000000000000265501210001000000000000265601210001000000000000265701210001000000000000265801210001000000000000265901210001000000000000265a01210001000000000000265b01210001000000000000265c01210001000000000000265d01210001000000000000265e01210001000000000000265f01210001000000000000266001210001000000000000266101210001000000000000266201210001000000000000266301210001000000000000266401210001000000000000266501210001000000000000266601210001000000000000266701210001000000000000266801210001000000000000266901210001000000000000266a01210001000000000000266b01210001000000000000266c01210001000000000000266d01210001000000000000266e01210001000000000000266f01210001000000000000267001210001000000000000267101210001000000000000267201210001000000000000267301210001000000000000267401210001000000000000267501210001000000000000267601210001000000000000267701210001000000000000267801210001000000000000267901210001000000000000267a01210001000000000000267b01210001000000000000267c01210001000000000000267d01210001000000000000267e01210001000000000000267f01210001000000000000268001210001000000000000268101210001000000000000268201210001000000000000268301210001000000000000268401210001000000000000268501210001000000000000268601210001000000000000268701210001000000000000268801210001000000000000268901210001000000000000268a01210001000000000000268b01210001000000000000268c01210001000000000000268d01210001000000000000268e01210001000000000000268f01210001000000000000269001210001000000000000269101210001000000000000269201210001000000000000269301210001000000000000269401210001000000000000269501210001000000000000269601210001000000000000269701210001000000000000269801210001000000000000269901210001000000000000269a01210001000000000000269b01210001000000000000269c01210001000000000000269d01210001000000000000269e01210001000000000000269f0121000100000000000026a00121000100000000000026a10121000100000000000026a20121000100000000000026a30121000100000000000026a40121000100000000000026a50121000100000000000026a60121000100000000000026a70121000100000000000026a80121000100000000000026a90121000100000000000026aa0121000100000000000026ab0121000100000000000026ac0121000100000000000026ad0121000100000000000026ae0121000100000000000026af0121000100000000000026b00121000100000000000026b10121000100000000000026b20121000100000000000026b30121000100000000000026b40121000100000000000026b50121000100000000000026b60121000100000000000026b70121000100000000000026b80121000100000000000026b90121000100000000000026ba0121000100000000000026bb0121000100000000000026bc0121000100000000000026bd0121000100000000000026be0121000100000000000026bf0121000100000000000026c00121000100000000000026c10121000100000000000026c20121000100000000000026c30121000100000000000026c40121000100000000000026c50121000100000000000026c60121000100000000000026c70121000100000000000026c80121000100000000000026c90121000100000000000026ca0121000100000000000026cb0121000100000000000026cc0121000100000000000026cd0121000100000000000026ce0121000100000000000026cf0121000100000000000026d00121000100000000000026d10121000100000000000026d20121000100000000000026d30121000100000000000026d40121000100000000000026d50121000100000000000026d60121000100000000000026d70121000100000000000026d80121000100000000000026d90121000100000000000026da0121000100000000000026db0121000100000000000026dc0121000100000000000026dd0121000100000000000026de0121000100000000000026df0121000100000000000026e00121000100000000000026e10121000100000000000026e20121000100000000000026e30121000100000000000026e40121000100000000000026e50121000100000000000026e60121000100000000000026e70121000100000000000026e80121000100000000000026e90121000100000000000026ea0121000100000000000026eb0121000100000000000026ec0121000100000000000026ed0121000100000000000026ee0121000100000000000026ef0121000100000000000026f00121000100000000000026f10121000100000000000026f20121000100000000000026f30121000100000000000026f40121000100000000000026f50121000100000000000026f60121000100000000000026f70121000100000000000026f80121000100000000000026f90121000100000000000026fa0121000100000000000026fb0121000100000000000026fc0121000100000000000026fd0121000100000000000026fe0121000100000000000026ff01210001000000000000270001210001000000000000270101210001000000000000270201210001000000000000270301210001000000000000270401210001000000000000270501210001000000000000270601210001000000000000270701210001000000000000270801210001000000000000270901210001000000000000270a01210001000000000000270b01210001000000000000270c01210001000000000000270d01210001000000000000270e01210001000000000000270f01210001000000000000271001210021038004869696edc6120c67eb6f000a3e4e13d13ae10755e2f378ca9c250c0d6465706f7369745f62617463682101830020200020220100012101200741017bef0360750c2b1257a6aad07673f97b25bb97ac076e1f0c058ab592d282449e390d3985cf1dd8052516e6d7fc870a41757064c9a80d71211174f0e9724cab3622000121012007410069fe1e5e3f3667a6af147eda05133bc47d077d6e30e08236b341d834d74231271b9bd269087ea38b1fe707ba170d865c5932e169588a78362e052336eb3d1563 \ No newline at end of file diff --git a/benches/build.rs b/benches/build.rs new file mode 100644 index 00000000..d987a32b --- /dev/null +++ b/benches/build.rs @@ -0,0 +1,4 @@ +fn main() { + println!("cargo:rustc-link-lib=dylib=radix_engine_toolkit"); + println!("cargo:rustc-link-search=native=./lib"); +} diff --git a/benches/lib/libradix_engine_toolkit.dylib b/benches/lib/libradix_engine_toolkit.dylib new file mode 100755 index 00000000..3c84f0a7 Binary files /dev/null and b/benches/lib/libradix_engine_toolkit.dylib differ diff --git a/benches/src/lib.rs b/benches/src/lib.rs new file mode 100644 index 00000000..c04cf310 --- /dev/null +++ b/benches/src/lib.rs @@ -0,0 +1,159 @@ +use radix_engine_toolkit::request::*; +use serde::{de::DeserializeOwned, Serialize}; + +mod ffi { + pub type Pointer = *mut std::ffi::c_char; + + extern "C" { + pub fn information(pointer: Pointer) -> Pointer; + pub fn convert_manifest(pointer: Pointer) -> Pointer; + pub fn analyze_manifest(pointer: Pointer) -> Pointer; + pub fn analyze_manifest_with_preview_context(pointer: Pointer) -> Pointer; + pub fn compile_transaction_intent(pointer: Pointer) -> Pointer; + pub fn compile_signed_transaction_intent(pointer: Pointer) -> Pointer; + pub fn compile_notarized_transaction(pointer: Pointer) -> Pointer; + pub fn decompile_transaction_intent(pointer: Pointer) -> Pointer; + pub fn decompile_signed_transaction_intent(pointer: Pointer) -> Pointer; + pub fn decompile_notarized_transaction(pointer: Pointer) -> Pointer; + pub fn decompile_unknown_transaction_intent(pointer: Pointer) -> Pointer; + pub fn derive_babylon_address_from_olympia_address(pointer: Pointer) -> Pointer; + pub fn derive_virtual_account_address(pointer: Pointer) -> Pointer; + pub fn derive_virtual_identity_address(pointer: Pointer) -> Pointer; + pub fn derive_non_fungible_global_id_from_public_key(pointer: Pointer) -> Pointer; + pub fn encode_address(pointer: Pointer) -> Pointer; + pub fn decode_address(pointer: Pointer) -> Pointer; + pub fn sbor_encode(pointer: Pointer) -> Pointer; + pub fn sbor_decode(pointer: Pointer) -> Pointer; + pub fn known_entity_addresses(pointer: Pointer) -> Pointer; + pub fn statically_validate_transaction(pointer: Pointer) -> Pointer; + pub fn hash(pointer: Pointer) -> Pointer; + + pub fn toolkit_alloc(capacity: usize) -> Pointer; + pub fn _toolkit_free(pointer: Pointer, capacity: usize); + pub fn toolkit_free_c_string(pointer: Pointer); + } +} + +#[derive(Debug)] +pub struct Error; + +pub struct RadixEngineToolkit; +impl RadixEngineToolkit { + fn invoke_fn(function: F, request: S) -> Result + where + F: Fn(ffi::Pointer) -> ffi::Pointer, + { + let request_pointer = Self::write_object_to_memory(request); + let response_pointer = function(request_pointer); + + let response_string = Self::read_string(response_pointer)?; + let response = if let Ok(response) = Self::deserialize::(&response_string) { + Ok(response) + } else if let Ok(response) = + Self::deserialize::(&response_string) + { + println!("{:?}", response); + Err(Error) + } else { + return Err(Error); + }; + + Self::free_memory(request_pointer); + Self::free_memory(response_pointer); + + response + } + + fn write_object_to_memory(object: S) -> ffi::Pointer { + let serialized_object = Self::serialize(object); + let pointer = Self::allocate_memory_for_string(&serialized_object); + Self::write_string(serialized_object, pointer); + pointer + } + + fn serialize(object: S) -> String { + serde_json::to_string(&object).expect("Could not serialize a trusted payload") + } + + fn deserialize>(string: S) -> Result { + let str = string.as_ref(); + serde_json::from_str(str).map_err(|_| Error) + } + + fn write_string>(string: S, pointer: ffi::Pointer) { + let string = string.as_ref(); + let mut string_bytes = string.as_bytes().to_vec(); + string_bytes.push(0); + + unsafe { + pointer.copy_from( + string_bytes.as_ptr() as radix_engine_toolkit::buffer::Pointer, + string_bytes.len(), + ); + } + } + + fn read_string(pointer: ffi::Pointer) -> Result { + unsafe { + std::ffi::CStr::from_ptr(pointer as *const std::ffi::c_char) + .to_str() + .map_err(|_| Error) + .map(|string| string.to_owned()) + } + } + + fn allocate_memory_for_string>(string: S) -> ffi::Pointer { + let string = string.as_ref(); + let byte_count = string.len(); + Self::allocate_memory_by_capacity(byte_count + 1) + } + + fn allocate_memory_by_capacity(capacity: usize) -> ffi::Pointer { + unsafe { ffi::toolkit_alloc(capacity) } + } + + fn free_memory(pointer: ffi::Pointer) { + unsafe { ffi::toolkit_free_c_string(pointer) } + } +} + +pub trait Invoke { + type Output: DeserializeOwned; + + fn invoke(request: T) -> Result; +} + +macro_rules! impl_invoke { + ($request: path, $response: path, $fn_ident: path) => { + impl Invoke<$request> for RadixEngineToolkit { + type Output = $response; + + fn invoke(request: $request) -> Result { + Self::invoke_fn(|pointer| unsafe { $fn_ident(pointer) }, request) + } + } + }; +} + +impl_invoke! { InformationRequest, InformationResponse, ffi::information } +impl_invoke! { ConvertManifestRequest, ConvertManifestResponse, ffi::convert_manifest } +impl_invoke! { AnalyzeManifestRequest, AnalyzeManifestResponse, ffi::analyze_manifest } +impl_invoke! { AnalyzeManifestWithPreviewContextRequest, AnalyzeManifestWithPreviewContextResponse, ffi::analyze_manifest_with_preview_context } +impl_invoke! { CompileTransactionIntentRequest, CompileTransactionIntentResponse, ffi::compile_transaction_intent } +impl_invoke! { CompileSignedTransactionIntentRequest, CompileSignedTransactionIntentResponse, ffi::compile_signed_transaction_intent } +impl_invoke! { CompileNotarizedTransactionRequest, CompileNotarizedTransactionResponse, ffi::compile_notarized_transaction } +impl_invoke! { DecompileTransactionIntentRequest, DecompileTransactionIntentResponse, ffi::decompile_transaction_intent } +impl_invoke! { DecompileSignedTransactionIntentRequest, DecompileSignedTransactionIntentResponse, ffi::decompile_signed_transaction_intent } +impl_invoke! { DecompileNotarizedTransactionRequest, DecompileNotarizedTransactionResponse, ffi::decompile_notarized_transaction } +impl_invoke! { DecompileUnknownTransactionIntentRequest, DecompileUnknownTransactionIntentResponse, ffi::decompile_unknown_transaction_intent } +impl_invoke! { DeriveBabylonAddressFromOlympiaAddressRequest, DeriveBabylonAddressFromOlympiaAddressResponse, ffi::derive_babylon_address_from_olympia_address } +impl_invoke! { DeriveVirtualAccountAddressRequest, DeriveVirtualAccountAddressResponse, ffi::derive_virtual_account_address } +impl_invoke! { DeriveVirtualIdentityAddressRequest, DeriveVirtualIdentityAddressResponse, ffi::derive_virtual_identity_address } +impl_invoke! { DeriveNonFungibleGlobalIdFromPublicKeyRequest, DeriveNonFungibleGlobalIdFromPublicKeyResponse, ffi::derive_non_fungible_global_id_from_public_key } +impl_invoke! { EncodeAddressRequest, EncodeAddressResponse, ffi::encode_address } +impl_invoke! { DecodeAddressRequest, DecodeAddressResponse, ffi::decode_address } +impl_invoke! { SborEncodeRequest, SborEncodeResponse, ffi::sbor_encode } +impl_invoke! { SborDecodeRequest, SborDecodeResponse, ffi::sbor_decode } +impl_invoke! { KnownEntityAddressesRequest, KnownEntityAddressesResponse, ffi::known_entity_addresses } +impl_invoke! { StaticallyValidateTransactionRequest, StaticallyValidateTransactionResponse, ffi::statically_validate_transaction } +impl_invoke! { HashRequest, HashResponse, ffi::hash } diff --git a/cli-json-interface/Cargo.toml b/cli-json-interface/Cargo.toml new file mode 100644 index 00000000..a778f789 --- /dev/null +++ b/cli-json-interface/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "cli-json-interface" +version = "0.9.0" +edition = "2021" + +[dependencies] +# Used for creating the CLI +clap = { version = "4.1.8", features = ["derive", "string"] } + +# The core Radix Engine Toolkit dependency to be exposed by this interface. +radix-engine-toolkit = { path = "../radix-engine-toolkit" } + +# Serde Dependencies +serde = "1.0.152" +serde_json = "1.0.93" + +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148", package = "transaction" } +radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +hex = "0.4.3" + +[[bin]] +name = "ret-cli" +path = "src/main.rs" + +[workspace] +members = [] diff --git a/cli-json-interface/src/cli.rs b/cli-json-interface/src/cli.rs new file mode 100644 index 00000000..a14c36cd --- /dev/null +++ b/cli-json-interface/src/cli.rs @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#[derive(clap::Parser, Debug)] +pub struct Cli { + #[clap(subcommand)] + pub command: Command, +} + +#[derive(clap::Subcommand, Debug)] +pub enum Command { + #[clap(subcommand)] + Address(super::subcommands::address::Address), + + #[clap(subcommand)] + Sbor(super::subcommands::sbor::Sbor), + + #[clap(subcommand)] + Transaction(super::subcommands::transaction::Transaction), + + #[clap(subcommand)] + Utils(super::subcommands::utils::Utils), +} diff --git a/cli-json-interface/src/error.rs b/cli-json-interface/src/error.rs new file mode 100644 index 00000000..95772e64 --- /dev/null +++ b/cli-json-interface/src/error.rs @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#![allow(clippy::enum_variant_names)] + +use native_transaction::manifest::{generator::GeneratorError, DecompileError}; + +pub type Result = std::result::Result; + +#[derive(Debug)] +pub enum Error { + RadixEngineToolkitError(radix_engine_toolkit::error::Error), + InvalidFileFormat { + expected: Vec, + found: String, + }, + IoError(std::io::Error), + DeserializationError(serde_json::error::Error), + HexDecodeError(hex::FromHexError), + GeneratorError(GeneratorError), + DecompileError(DecompileError), + InvalidPublicKey, + InvalidStringConversion, +} + +impl From for Error { + fn from(value: radix_engine_toolkit::error::Error) -> Self { + Self::RadixEngineToolkitError(value) + } +} + +impl From for Error { + fn from(value: std::io::Error) -> Self { + Self::IoError(value) + } +} + +impl From for Error { + fn from(value: serde_json::error::Error) -> Self { + Self::DeserializationError(value) + } +} + +impl From for Error { + fn from(value: hex::FromHexError) -> Self { + Self::HexDecodeError(value) + } +} + +impl From for Error { + fn from(value: GeneratorError) -> Self { + Self::GeneratorError(value) + } +} + +impl From for Error { + fn from(value: DecompileError) -> Self { + Self::DecompileError(value) + } +} diff --git a/cli-json-interface/src/main.rs b/cli-json-interface/src/main.rs new file mode 100644 index 00000000..2a0d120e --- /dev/null +++ b/cli-json-interface/src/main.rs @@ -0,0 +1,35 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +mod cli; +mod error; +mod subcommands; +mod utils; + +use clap::Parser; + +pub fn main() -> crate::error::Result<()> { + let cli = cli::Cli::parse(); + let mut out = std::io::stdout(); + + match cli.command { + cli::Command::Address(cmd) => cmd.run(&mut out), + cli::Command::Transaction(cmd) => cmd.run(&mut out), + cli::Command::Sbor(cmd) => cmd.run(&mut out), + cli::Command::Utils(cmd) => cmd.run(&mut out), + } +} diff --git a/cli-json-interface/src/subcommands/address/babylon_address_from_olympia_address.rs b/cli-json-interface/src/subcommands/address/babylon_address_from_olympia_address.rs new file mode 100644 index 00000000..43d2aca5 --- /dev/null +++ b/cli-json-interface/src/subcommands/address/babylon_address_from_olympia_address.rs @@ -0,0 +1,47 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::request::{ + DeriveBabylonAddressFromOlympiaAddressHandler, DeriveBabylonAddressFromOlympiaAddressRequest, + Handler, +}; + +#[derive(Parser, Debug)] +/// Derives the Babylon account address for a given Olympia account address. +pub struct BabylonAddressFromOlympiaAddress { + /// The Olympia account address to derive the Babylon address for. + #[clap(short, long)] + olympia_account_address: String, + + /// The network id to derive the known addresses for. + #[clap(short, long)] + network_id: u8, +} + +impl BabylonAddressFromOlympiaAddress { + pub fn run(&self, out: &mut O) -> Result<()> { + let request = DeriveBabylonAddressFromOlympiaAddressRequest { + network_id: self.network_id, + olympia_account_address: self.olympia_account_address.clone(), + }; + let response = DeriveBabylonAddressFromOlympiaAddressHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/address/decode.rs b/cli-json-interface/src/subcommands/address/decode.rs new file mode 100644 index 00000000..d9621bc3 --- /dev/null +++ b/cli-json-interface/src/subcommands/address/decode.rs @@ -0,0 +1,39 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::request::{DecodeAddressHandler, DecodeAddressRequest, Handler}; + +/// Decodes the Bech32 address revealing some information on what exactly does it address. +#[derive(Parser, Debug)] +pub struct Decode { + /// The Bech32m encoded address to decode. + #[clap(short, long)] + address: String, +} + +impl Decode { + pub fn run(&self, out: &mut O) -> Result<()> { + let request = DecodeAddressRequest { + address: self.address.clone(), + }; + let response = DecodeAddressHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/address/encode.rs b/cli-json-interface/src/subcommands/address/encode.rs new file mode 100644 index 00000000..d9d1c5cb --- /dev/null +++ b/cli-json-interface/src/subcommands/address/encode.rs @@ -0,0 +1,45 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::request::{EncodeAddressHandler, EncodeAddressRequest, Handler}; + +#[derive(Parser, Debug)] +/// Encodes a raw address into a Bech32 encoded address. +pub struct Encode { + /// The raw address to Bech32m encode. This is 27-byte long raw address serialized as a 54 + /// character long hexadecimal string. + #[clap(short, long)] + raw_address: String, + + /// The network id to use for encoding the address. + #[clap(short, long)] + network_id: u8, +} + +impl Encode { + pub fn run(&self, out: &mut O) -> Result<()> { + let request = EncodeAddressRequest { + address_bytes: hex::decode(&self.raw_address)?, + network_id: self.network_id, + }; + let response = EncodeAddressHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/address/known_addresses.rs b/cli-json-interface/src/subcommands/address/known_addresses.rs new file mode 100644 index 00000000..27c22afb --- /dev/null +++ b/cli-json-interface/src/subcommands/address/known_addresses.rs @@ -0,0 +1,41 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::request::{ + Handler, KnownEntityAddressesHandler, KnownEntityAddressesRequest, +}; + +#[derive(Parser, Debug)] +/// Derives the list of known entity addresses on the given network +pub struct KnownAddresses { + /// The network id to derive the known addresses for. + #[clap(short, long)] + network_id: u8, +} + +impl KnownAddresses { + pub fn run(&self, out: &mut O) -> Result<()> { + let request = KnownEntityAddressesRequest { + network_id: self.network_id, + }; + let response = KnownEntityAddressesHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/address/mod.rs b/cli-json-interface/src/subcommands/address/mod.rs new file mode 100644 index 00000000..9c039313 --- /dev/null +++ b/cli-json-interface/src/subcommands/address/mod.rs @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +mod babylon_address_from_olympia_address; +mod decode; +mod encode; +mod known_addresses; +mod virtual_account_address; +mod virtual_identity_address; + +/// A subcommand for all address related commands. +#[derive(clap::Subcommand, Debug)] +pub enum Address { + Encode(encode::Encode), + Decode(decode::Decode), + KnownAddresses(known_addresses::KnownAddresses), + VirtualAccountAddress(virtual_account_address::VirtualAccountAddress), + VirtualIdentityAddress(virtual_identity_address::VirtualIdentityAddress), + BabylonAccountAddressFromOlympiaAddress( + babylon_address_from_olympia_address::BabylonAddressFromOlympiaAddress, + ), +} + +impl Address { + pub fn run(&self, out: &mut O) -> crate::error::Result<()> { + match self { + Self::Encode(cmd) => cmd.run(out), + Self::Decode(cmd) => cmd.run(out), + Self::KnownAddresses(cmd) => cmd.run(out), + Self::VirtualAccountAddress(cmd) => cmd.run(out), + Self::VirtualIdentityAddress(cmd) => cmd.run(out), + Self::BabylonAccountAddressFromOlympiaAddress(cmd) => cmd.run(out), + } + } +} diff --git a/cli-json-interface/src/subcommands/address/virtual_account_address.rs b/cli-json-interface/src/subcommands/address/virtual_account_address.rs new file mode 100644 index 00000000..31f8e128 --- /dev/null +++ b/cli-json-interface/src/subcommands/address/virtual_account_address.rs @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::{Error, Result}; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::request::{ + DeriveVirtualAccountAddressHandler, DeriveVirtualAccountAddressRequest, Handler, +}; +use radix_engine_toolkit::utils::checked_copy_u8_slice; +use scrypto::prelude::{EcdsaSecp256k1PublicKey, EddsaEd25519PublicKey}; + +#[derive(Parser, Debug)] +/// Derives virtual account address of the given public key on the given network +pub struct VirtualAccountAddress { + /// The public key to derive the virtual component address for. + #[clap(short, long)] + public_key: String, + + /// The network id to derive the known addresses for. + #[clap(short, long)] + network_id: u8, +} + +impl VirtualAccountAddress { + pub fn run(&self, out: &mut O) -> Result<()> { + let public_key_bytes = hex::decode(&self.public_key)?; + let public_key = match public_key_bytes.len() { + EcdsaSecp256k1PublicKey::LENGTH => { + Ok(EcdsaSecp256k1PublicKey(checked_copy_u8_slice(&public_key_bytes)?).into()) + } + EddsaEd25519PublicKey::LENGTH => { + Ok(EddsaEd25519PublicKey(checked_copy_u8_slice(&public_key_bytes)?).into()) + } + _ => Err(Error::InvalidPublicKey), + }?; + + let request = DeriveVirtualAccountAddressRequest { + public_key, + network_id: self.network_id, + }; + let response = DeriveVirtualAccountAddressHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/address/virtual_identity_address.rs b/cli-json-interface/src/subcommands/address/virtual_identity_address.rs new file mode 100644 index 00000000..49b684c2 --- /dev/null +++ b/cli-json-interface/src/subcommands/address/virtual_identity_address.rs @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::{Error, Result}; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::request::{ + DeriveVirtualIdentityAddressHandler, DeriveVirtualIdentityAddressRequest, Handler, +}; +use radix_engine_toolkit::utils::checked_copy_u8_slice; +use scrypto::prelude::{EcdsaSecp256k1PublicKey, EddsaEd25519PublicKey}; + +#[derive(Parser, Debug)] +/// Derives virtual identity address of the given public key on the given network +pub struct VirtualIdentityAddress { + /// The public key to derive the virtual component address for. + #[clap(short, long)] + public_key: String, + + /// The network id to derive the known addresses for. + #[clap(short, long)] + network_id: u8, +} + +impl VirtualIdentityAddress { + pub fn run(&self, out: &mut O) -> Result<()> { + let public_key_bytes = hex::decode(&self.public_key)?; + let public_key = match public_key_bytes.len() { + EcdsaSecp256k1PublicKey::LENGTH => { + Ok(EcdsaSecp256k1PublicKey(checked_copy_u8_slice(&public_key_bytes)?).into()) + } + EddsaEd25519PublicKey::LENGTH => { + Ok(EddsaEd25519PublicKey(checked_copy_u8_slice(&public_key_bytes)?).into()) + } + _ => Err(Error::InvalidPublicKey), + }?; + + let request = DeriveVirtualIdentityAddressRequest { + public_key, + network_id: self.network_id, + }; + let response = DeriveVirtualIdentityAddressHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/mod.rs b/cli-json-interface/src/subcommands/mod.rs new file mode 100644 index 00000000..cf8bf7c1 --- /dev/null +++ b/cli-json-interface/src/subcommands/mod.rs @@ -0,0 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod address; +pub mod sbor; +pub mod transaction; +pub mod utils; diff --git a/cli-json-interface/src/subcommands/sbor/decode.rs b/cli-json-interface/src/subcommands/sbor/decode.rs new file mode 100644 index 00000000..be10c7c6 --- /dev/null +++ b/cli-json-interface/src/subcommands/sbor/decode.rs @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::request::{Handler, SborDecodeHandler, SborDecodeRequest}; + +/// Decodes a Manifest and Scrypto SBOR encoded payloads. +#[derive(Parser, Debug)] +pub struct Decode { + /// The SBOR encoded payload to decode + #[clap(short, long)] + payload: String, + + /// The network id to use. This is primarily used for decoding addresses + #[clap(short, long)] + network_id: u8, +} + +impl Decode { + pub fn run(&self, out: &mut O) -> Result<()> { + let request = SborDecodeRequest { + encoded_value: hex::decode(&self.payload)?, + network_id: self.network_id, + }; + let response = SborDecodeHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/sbor/encode.rs b/cli-json-interface/src/subcommands/sbor/encode.rs new file mode 100644 index 00000000..4c01095a --- /dev/null +++ b/cli-json-interface/src/subcommands/sbor/encode.rs @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::request::{Handler, SborEncodeHandler}; + +#[derive(Parser, Debug)] +/// Encodes a payload using SBOR. +pub struct Encode { + /// The payload to SBOR encode + #[clap(short, long)] + payload: String, +} + +impl Encode { + pub fn run(&self, out: &mut O) -> Result<()> { + let request = serde_json::from_str(&self.payload)?; + let response = SborEncodeHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/sbor/mod.rs b/cli-json-interface/src/subcommands/sbor/mod.rs new file mode 100644 index 00000000..a0845acf --- /dev/null +++ b/cli-json-interface/src/subcommands/sbor/mod.rs @@ -0,0 +1,35 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +mod decode; +mod encode; + +/// A subcommand for all address SBOR related commands. +#[derive(clap::Subcommand, Debug)] +pub enum Sbor { + Encode(encode::Encode), + Decode(decode::Decode), +} + +impl Sbor { + pub fn run(&self, out: &mut O) -> crate::error::Result<()> { + match self { + Self::Encode(cmd) => cmd.run(out), + Self::Decode(cmd) => cmd.run(out), + } + } +} diff --git a/cli-json-interface/src/subcommands/transaction/analyze_manifest.rs b/cli-json-interface/src/subcommands/transaction/analyze_manifest.rs new file mode 100644 index 00000000..3fcbaf3b --- /dev/null +++ b/cli-json-interface/src/subcommands/transaction/analyze_manifest.rs @@ -0,0 +1,82 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::path::PathBuf; + +use clap::Parser; +use radix_engine_toolkit::model::transaction::{ + InstructionKind, InstructionList, TransactionManifest, +}; +use radix_engine_toolkit::request::{AnalyzeManifestHandler, AnalyzeManifestRequest, Handler}; + +use crate::error::{Error, Result}; +use crate::utils::pretty_print; + +#[derive(Parser, Debug)] +/// Analyzes the manifest for all of the included addresses in the manifest. +pub struct AnalyzeManifest { + /// The path to a manifest file. This can either be a standard `.rtm` file of the manifest in + /// text form or could be the path to a `.json` file of the JSON based manifest abstract syntax + /// tree. + #[clap(short, long)] + manifest_path: PathBuf, + + /// The id of the network to use for the analysis of the manifest + #[clap(short, long)] + network_id: u8, +} + +impl AnalyzeManifest { + pub fn run(&self, out: &mut O) -> Result<()> { + // Determine the type of input to expect from the file extension. + let input_type = match self + .manifest_path + .extension() + .and_then(|string| string.to_str()) + { + Some("rtm") => Ok(InstructionKind::String), + Some("json") => Ok(InstructionKind::Parsed), + Some(value) => Err(Error::InvalidFileFormat { + expected: vec!["json".into(), "rtm".into()], + found: value.to_string(), + }), + None => Err(Error::InvalidFileFormat { + expected: vec!["json".into(), "rtm".into()], + found: "".into(), + }), + }?; + + // Load the instructions from file + let instructions = { + let file_content = std::fs::read_to_string(&self.manifest_path)?; + match input_type { + InstructionKind::String => InstructionList::String(file_content), + InstructionKind::Parsed => serde_json::from_str(&file_content)?, + } + }; + + let request = AnalyzeManifestRequest { + manifest: TransactionManifest { + instructions, + blobs: vec![], + }, + network_id: self.network_id, + }; + let response = AnalyzeManifestHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/transaction/convert_manifest.rs b/cli-json-interface/src/subcommands/transaction/convert_manifest.rs new file mode 100644 index 00000000..de2d6fd2 --- /dev/null +++ b/cli-json-interface/src/subcommands/transaction/convert_manifest.rs @@ -0,0 +1,170 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::path::PathBuf; + +use clap::Parser; +use native_transaction::manifest::decompile; +use native_transaction::manifest::generator::generate_manifest; +use radix_engine_toolkit::model::address::Bech32Coder; +use radix_engine_toolkit::model::instruction::Instruction; +use radix_engine_toolkit::model::transaction::{InstructionKind, InstructionList}; +use radix_engine_toolkit::model::value::ast::ManifestAstValue; +use radix_engine_toolkit::utils::checked_copy_u8_slice; +use radix_engine_toolkit::visitor::{traverse_instruction, ManifestAstValueVisitor}; +use scrypto::prelude::Hash; + +use crate::error::{Error, Result}; +use crate::utils::pretty_print; + +#[derive(Parser, Debug)] +/// Converts transaction manifests from one format to another. Currently, this can perform two way +/// conversion from and to the regular string based format of manifests to a JSON based format of +/// the Abstract Syntax Tree (AST) of the manifest. +/// +/// The conversion or output format is implicit rather than explicit. If a string manifest is the +/// input then a JSON manifest is the output. Similarly, if a JSON manifest is the input, then a +/// string manifest is the output. +pub struct ConvertManifest { + /// The path to a manifest file. This can either be a standard `.rtm` file of the manifest in + /// text form or could be the path to a `.json` file of the JSON based manifest abstract syntax + /// tree. + #[clap(short, long)] + manifest_path: PathBuf, + + /// The id of the network to use when performing the manifest conversion. This will be used in + /// validation and also in the generation of the converted manifest. + #[clap(short, long)] + network_id: u8, +} + +impl ConvertManifest { + pub fn run(&self, out: &mut O) -> Result<()> { + // The Bech32 Encoder and Decoder to use for this operation + let bech32_coder = Bech32Coder::new(self.network_id); + + // Determine the type of input to expect from the file extension. + let input_type = match self + .manifest_path + .extension() + .and_then(|string| string.to_str()) + { + Some("rtm") => Ok(InstructionKind::String), + Some("json") => Ok(InstructionKind::Parsed), + Some(value) => Err(Error::InvalidFileFormat { + expected: vec!["json".into(), "rtm".into()], + found: value.to_string(), + }), + None => Err(Error::InvalidFileFormat { + expected: vec!["json".into(), "rtm".into()], + found: "".into(), + }), + }?; + + // Load the instructions from file + let mut instructions = { + let file_content = std::fs::read_to_string(&self.manifest_path)?; + match input_type { + InstructionKind::String => InstructionList::String(file_content), + InstructionKind::Parsed => serde_json::from_str(&file_content)?, + } + }; + + // Attempt to get whatever blobs we need from the instructions that we have. + let blob_references = match instructions { + InstructionList::String(..) => { + // Parse the string manifest into a native abstract syntax tree manifest. + let instructions = instructions.ast_instructions(&bech32_coder)?; + + // We will aggregate the blob references from the package publishing into a vector. + // We do not care about other blobs since they're technically unusable in Scrypto + // and would not make sense to include + let mut blob_references = Vec::new(); + for instruction in instructions { + if let native_transaction::manifest::ast::Instruction::PublishPackage { + code: native_transaction::manifest::ast::Value::Blob(code), + schema: native_transaction::manifest::ast::Value::Blob(abi), + .. + } = instruction + { + if let ( + native_transaction::manifest::ast::Value::String(code), + native_transaction::manifest::ast::Value::String(abi), + ) = (*code, *abi) + { + blob_references.push(checked_copy_u8_slice(&hex::decode(code)?)?); + blob_references.push(checked_copy_u8_slice(&hex::decode(abi)?)?); + } + } + } + blob_references + } + InstructionList::Parsed(ref mut instructions) => { + let mut value_visitor = BlobValueVisitor::default(); + for instruction in instructions.iter_mut() { + traverse_instruction(instruction, &mut [&mut value_visitor], &mut [])?; + } + value_visitor.0 + } + }; + + // Perform the conversion into the other kind of instructions + let output = match input_type { + InstructionKind::String => { + // Parse the string manifest into a native abstract syntax tree manifest. + let instructions = instructions.ast_instructions(&bech32_coder)?; + let instructions = instructions + .into_iter() + .map(|instruction| { + Instruction::from_ast_instruction(&instruction, &bech32_coder) + }) + .collect::>>()?; + InstructionList::Parsed(instructions) + } + InstructionKind::Parsed => { + let instructions = instructions.ast_instructions(&bech32_coder)?; + let manifest = generate_manifest( + &instructions, + bech32_coder.decoder(), + blob_references + .into_iter() + .map(|blob_hash| (Hash(blob_hash), vec![])) + .collect(), + )?; + let string = decompile(&manifest.instructions, bech32_coder.network_definition())?; + InstructionList::String(string) + } + }; + + pretty_print(&output, out)?; + Ok(()) + } +} + +#[derive(Default)] +struct BlobValueVisitor(Vec<[u8; 32]>); +impl ManifestAstValueVisitor for BlobValueVisitor { + fn visit_blob( + &mut self, + value: &mut radix_engine_toolkit::model::value::ast::ManifestAstValue, + ) -> radix_engine_toolkit::error::Result<()> { + if let ManifestAstValue::Blob { hash } = value { + self.0.push(hash.0); + } + Ok(()) + } +} diff --git a/cli-json-interface/src/subcommands/transaction/decompile.rs b/cli-json-interface/src/subcommands/transaction/decompile.rs new file mode 100644 index 00000000..bcd7a2f8 --- /dev/null +++ b/cli-json-interface/src/subcommands/transaction/decompile.rs @@ -0,0 +1,103 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::str::FromStr; + +use crate::error::{Error, Result}; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::model::transaction::InstructionKind; +use radix_engine_toolkit::request::{ + DecompileUnknownTransactionIntentHandler, DecompileUnknownTransactionIntentRequest, Handler, +}; + +/// Decompiles a Manifest and Scrypto SBOR encoded payloads. +#[derive(Parser, Debug)] +pub struct Decompile { + /// The SBOR encoded payload to decode + #[clap(short, long)] + payload: String, + + /// The network id to use. This is primarily used for decoding addresses + #[clap(short, long, default_value = "String")] + output_instructions_kind: ManifestInstructionKind, +} + +impl Decompile { + pub fn run(&self, out: &mut O) -> Result<()> { + let request = DecompileUnknownTransactionIntentRequest { + compiled_unknown_intent: hex::decode(&self.payload)?, + instructions_output_kind: self.output_instructions_kind.clone().into(), + }; + let response = DecompileUnknownTransactionIntentHandler::fulfill(request)?; + pretty_print(&response, out) + } +} + +#[derive(Debug, Clone)] +pub enum ManifestInstructionKind { + String, + Parsed, +} + +impl From for ManifestInstructionKind { + // Clap no longer works with FromStr. + fn from(value: String) -> Self { + Self::from_str(&value).unwrap() + } +} + +impl FromStr for ManifestInstructionKind { + type Err = Error; + + fn from_str(s: &str) -> std::result::Result { + let lowercase_string = s.to_lowercase(); + match lowercase_string.as_str() { + "string" => Ok(Self::String), + "parsed" => Ok(Self::Parsed), + _ => Err(Error::InvalidStringConversion), + } + } +} + +impl std::fmt::Display for ManifestInstructionKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let string = match self { + Self::String => "String", + Self::Parsed => "Parsed", + }; + write!(f, "{string}") + } +} + +impl From for InstructionKind { + fn from(value: ManifestInstructionKind) -> Self { + match value { + ManifestInstructionKind::Parsed => Self::Parsed, + ManifestInstructionKind::String => Self::String, + } + } +} + +impl From for ManifestInstructionKind { + fn from(value: InstructionKind) -> Self { + match value { + InstructionKind::Parsed => Self::Parsed, + InstructionKind::String => Self::String, + } + } +} diff --git a/cli-json-interface/src/subcommands/transaction/mod.rs b/cli-json-interface/src/subcommands/transaction/mod.rs new file mode 100644 index 00000000..04b22280 --- /dev/null +++ b/cli-json-interface/src/subcommands/transaction/mod.rs @@ -0,0 +1,38 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +mod analyze_manifest; +mod convert_manifest; +mod decompile; + +/// A subcommand for all transaction related commands. +#[derive(clap::Subcommand, Debug)] +pub enum Transaction { + AnalyzeManifest(analyze_manifest::AnalyzeManifest), + ConvertManifest(convert_manifest::ConvertManifest), + Decompile(decompile::Decompile), +} + +impl Transaction { + pub fn run(&self, out: &mut O) -> crate::error::Result<()> { + match self { + Self::AnalyzeManifest(cmd) => cmd.run(out), + Self::ConvertManifest(cmd) => cmd.run(out), + Self::Decompile(cmd) => cmd.run(out), + } + } +} diff --git a/cli-json-interface/src/subcommands/utils/hash.rs b/cli-json-interface/src/subcommands/utils/hash.rs new file mode 100644 index 00000000..9d7bbb12 --- /dev/null +++ b/cli-json-interface/src/subcommands/utils/hash.rs @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; +use crate::utils::pretty_print; +use clap::Parser; +use radix_engine_toolkit::request::{Handler, HashHandler, HashRequest}; + +#[derive(Parser, Debug)] +/// Hashes some data using the hashing algorithm of Scrypto and the Radix Engine. Currently, this +/// is Blake2b with 256 bit digests. +pub struct Hash { + /// A hex-encoded string of the data to hash + #[clap(short, long)] + data: String, +} + +impl Hash { + pub fn run(&self, out: &mut O) -> Result<()> { + let request = HashRequest { + payload: hex::decode(&self.data)?, + }; + let response = HashHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/utils/information.rs b/cli-json-interface/src/subcommands/utils/information.rs new file mode 100644 index 00000000..8c22e26e --- /dev/null +++ b/cli-json-interface/src/subcommands/utils/information.rs @@ -0,0 +1,35 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use clap::Parser; +use radix_engine_toolkit::request::{Handler, InformationHandler, InformationRequest}; + +use crate::error::Result; +use crate::utils::pretty_print; + +#[derive(Parser, Debug)] +/// Returns information on the Radix Engine Toolkit currently in use by the CLI. Includes +/// information such as the version and the commit hash. +pub struct Information; + +impl Information { + pub fn run(&self, out: &mut O) -> Result<()> { + let request = InformationRequest {}; + let response = InformationHandler::fulfill(request)?; + pretty_print(&response, out) + } +} diff --git a/cli-json-interface/src/subcommands/utils/mod.rs b/cli-json-interface/src/subcommands/utils/mod.rs new file mode 100644 index 00000000..fd5f65c5 --- /dev/null +++ b/cli-json-interface/src/subcommands/utils/mod.rs @@ -0,0 +1,35 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +mod hash; +mod information; + +/// A subcommand for a set of utility functions. +#[derive(clap::Subcommand, Debug)] +pub enum Utils { + Information(information::Information), + Hash(hash::Hash), +} + +impl Utils { + pub fn run(&self, out: &mut O) -> crate::error::Result<()> { + match self { + Self::Hash(cmd) => cmd.run(out), + Self::Information(cmd) => cmd.run(out), + } + } +} diff --git a/cli-json-interface/src/utils.rs b/cli-json-interface/src/utils.rs new file mode 100644 index 00000000..bb4599ae --- /dev/null +++ b/cli-json-interface/src/utils.rs @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; +use serde::Serialize; + +pub fn pretty_print(obj: &S, out: &mut O) -> Result<()> { + let buffer = { + let buffer = Vec::new(); + let formatter = serde_json::ser::PrettyFormatter::with_indent(b" "); + let mut serializer = serde_json::Serializer::with_formatter(buffer, formatter); + obj.serialize(&mut serializer).unwrap(); + + let mut bytes = serializer.into_inner(); + bytes.push(b'\n'); + bytes + }; + out.write_all(&buffer)?; + Ok(()) +} diff --git a/format.sh b/format.sh index 0b7cef21..eb84aec6 100755 --- a/format.sh +++ b/format.sh @@ -1 +1,3 @@ -cargo +nightly fmt \ No newline at end of file +cargo +nightly fmt +(cd native-json-interface; cargo +nightly fmt) +(cd cli-json-interface; cargo +nightly fmt) \ No newline at end of file diff --git a/native-json-interface/Cargo.toml b/native-json-interface/Cargo.toml index 007c74ed..55e570d9 100644 --- a/native-json-interface/Cargo.toml +++ b/native-json-interface/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "native-json-interface" -version = "0.8.1" +version = "0.9.0" edition = "2021" [dependencies] jni = { version = "0.20.0", default-features = false, optional = true } -radix-engine-toolkit = { path = "../radix-engine-toolkit" } +radix-engine-toolkit = { path = "../radix-engine-toolkit", default-features = false } serde = "1.0.152" serde_json = "1.0.91" @@ -25,8 +25,9 @@ name = "radix_engine_toolkit" crate-type = ["staticlib", "cdylib"] [features] -default = [] +default = ["jni", "radix-engine"] jni = ["jni/default"] +radix-engine = ["radix-engine-toolkit/radix-engine"] [workspace] -members = [] \ No newline at end of file +members = [] diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs index 54e8ead7..d42be94e 100644 --- a/native-json-interface/src/lib.rs +++ b/native-json-interface/src/lib.rs @@ -1,3 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + #![allow(clippy::missing_safety_doc)] #![allow(non_snake_case)] @@ -69,6 +86,10 @@ pub mod native { export_handler!(ConvertManifestHandler as convert_manifest); export_handler!(AnalyzeManifestHandler as analyze_manifest); + #[cfg(feature = "radix-engine")] + export_handler!( + AnalyzeManifestWithPreviewContextHandler as analyze_manifest_with_preview_context + ); export_handler!(CompileTransactionIntentHandler as compile_transaction_intent); export_handler!(CompileSignedTransactionIntentHandler as compile_signed_transaction_intent); @@ -81,6 +102,10 @@ pub mod native { DecompileUnknownTransactionIntentHandler as decompile_unknown_transaction_intent ); + export_handler!( + DeriveBabylonAddressFromOlympiaAddressHandler + as derive_babylon_address_from_olympia_address + ); export_handler!(DeriveVirtualAccountAddressHandler as derive_virtual_account_address); export_handler!(DeriveVirtualIdentityAddressHandler as derive_virtual_identity_address); export_handler!( @@ -96,6 +121,8 @@ pub mod native { export_handler!(KnownEntityAddressesHandler as known_entity_addresses); export_handler!(StaticallyValidateTransactionHandler as statically_validate_transaction); + + export_handler!(HashHandler as hash); } #[cfg(feature = "jni")] @@ -171,6 +198,11 @@ pub mod jni { export_handler!( AnalyzeManifestHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_analyzeManifest ); + #[cfg(feature = "radix-engine")] + export_handler!( + AnalyzeManifestWithPreviewContextHandler + as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_analyzeManifestWithPreviewContext + ); export_handler!( CompileTransactionIntentHandler @@ -202,6 +234,10 @@ pub mod jni { as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_decompileUnknownTransactionIntent ); + export_handler!( + DeriveBabylonAddressFromOlympiaAddressHandler + as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveBabylonAddressFromOlympiaAddress + ); export_handler!( DeriveVirtualAccountAddressHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveVirtualAccountAddress @@ -234,4 +270,6 @@ pub mod jni { StaticallyValidateTransactionHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_staticallyValidateTransaction ); + + export_handler!(HashHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_hash); } diff --git a/native-json-interface/tests/toolkit_wasm_wrapper.rs b/native-json-interface/tests/toolkit_wasm_wrapper.rs index 65c5b082..0e87f2c7 100644 --- a/native-json-interface/tests/toolkit_wasm_wrapper.rs +++ b/native-json-interface/tests/toolkit_wasm_wrapper.rs @@ -138,7 +138,13 @@ impl RadixEngineToolkit { // release. let status: std::process::ExitStatus = std::process::Command::new("cargo") .current_dir(&manifest_directory) - .args(["build", "--target", "wasm32-unknown-unknown", "--release"]) + .args([ + "build", + "--target", + "wasm32-unknown-unknown", + "--release", + "--no-default-features", + ]) .status() .expect("Compilation of WASM for tests failed"); if !status.success() { diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index 96f70bc9..c19b82f8 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "radix-engine-toolkit" -version = "0.8.1" +version = "0.9.0" edition = "2021" build = "build.rs" @@ -13,14 +13,16 @@ serde_with = { version = "2.2.0", features = ["hex"] } schemars = { version = "0.8.11", features = ["preserve_order"] } # An attribute macro to setup a model to be serializable and also to have a JSON schema. -serializable = { path = "../serializable" } +toolkit-derive = { path = "../toolkit-derive" } # Scrypto dependencies required for the core-toolkit -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148", package = "transaction" } +radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148", optional = true } +radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } # Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the # hex representation during serialization. @@ -30,6 +32,14 @@ hex = { version = "0.4.3", default-features = false } # don't expose through the Scrypto Bech32 encoder and decoder) bech32 = { version = "0.9.0", default-features = false } +# Used for more powerful declarative macros +paste = { version = "1.0.11" } +serde_json = "1.0.91" + [dev-dependencies] lazy_static = { version = "1.4.0" } -serde_json = { version = "1.0.91" } \ No newline at end of file +serde_json = { version = "1.0.91" } + +[features] +default = ["radix-engine"] +radix-engine = ["dep:radix-engine"] \ No newline at end of file diff --git a/radix-engine-toolkit/build.rs b/radix-engine-toolkit/build.rs index 840d134b..acd539ef 100644 --- a/radix-engine-toolkit/build.rs +++ b/radix-engine-toolkit/build.rs @@ -1,11 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + use std::process::Command; fn main() { // note: add error checking yourself. let output = Command::new("git") - .args(&["rev-parse", "HEAD"]) + .args(["rev-parse", "HEAD"]) .output() .unwrap(); - let git_hash = String::from_utf8(output.stdout).unwrap(); - println!("cargo:rustc-env=GIT_HASH={}", git_hash); + let last_commit_hash = String::from_utf8(output.stdout).unwrap(); + println!("cargo:rustc-env=GIT_HASH={}", last_commit_hash); } diff --git a/radix-engine-toolkit/src/enum_discriminator.rs b/radix-engine-toolkit/src/enum_discriminator.rs deleted file mode 100644 index af2cc247..00000000 --- a/radix-engine-toolkit/src/enum_discriminator.rs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -use crate::error::{Error, Result}; -use native_transaction::manifest::KNOWN_ENUM_DISCRIMINATORS; -use serializable::serializable; - -// ================= -// Model Definition -// ================= - -/// A union of the types of discriminators that enums may have. This may either be a string or an -/// 8-bit unsigned number. -#[serializable] -#[serde(tag = "type")] -#[derive(Hash, Eq, PartialEq, PartialOrd, Ord)] -pub enum EnumDiscriminator { - String { - /// A string discriminator of the fully qualified well-known enum name - discriminator: String, - }, - U8 { - /// An 8-bit unsigned integer serialized as a string. - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - discriminator: u8, - }, -} - -// ============ -// Conversions -// ============ - -impl EnumDiscriminator { - /// Resolves the enum discriminator to a [`u8`] discriminator. - pub fn resolve_discriminator(&self) -> Result { - match self { - Self::U8 { discriminator } => Ok(*discriminator), - Self::String { discriminator } => KNOWN_ENUM_DISCRIMINATORS - .get(discriminator.as_str()) - .copied() - .ok_or(Error::InvalidEnumDiscriminator { - discriminator: discriminator.clone(), - }), - } - } -} diff --git a/radix-engine-toolkit/src/error.rs b/radix-engine-toolkit/src/error.rs index f478599c..8282f588 100644 --- a/radix-engine-toolkit/src/error.rs +++ b/radix-engine-toolkit/src/error.rs @@ -17,9 +17,9 @@ use std::fmt::Display; -use serializable::serializable; +use toolkit_derive::serializable; -use crate::ValueKind; +use crate::model::{engine_identifier::BucketId, value::ast::ManifestAstValueKind}; /// The error model used by the Radix Engine Toolkit - Represents the set of all errors which the /// Radix Engine Toolkit may return for a request. @@ -54,12 +54,12 @@ pub enum Error { /// An error emitted when the passed `Value` is not one of the accepted value types for a given /// request or operation. InvalidKind { - /// A set of the expected `ValueKind`s for a given request or operation (this set forms an - /// 'or' and not an 'and'). - expected: Vec, + /// A set of the expected `ManifestAstValueKind`s for a given request or operation (this + /// set forms an 'or' and not an 'and'). + expected: Vec, - /// The `ValueKind` that was found. - found: ValueKind, + /// The `ManifestAstValueKind` that was found. + found: ManifestAstValueKind, }, /// An error emitted when an invalid enum discriminator is encountered. This typically means @@ -72,14 +72,6 @@ pub enum Error { // ===== // SBOR // ===== - /// An error emitted when some object of some value kind can not be encoded in SBOR without - /// additional context. This error is typically seen in situations when trying to encode either - /// a `Bucket("some_string")` or a `Proof("some_string")` as buckets or proofs with String - /// identifiers can not be encoded in SBOR without an ID Allocator. - BucketOrProofSBORError { - value_kind: ValueKind, - }, - /// Represents an error when trying to encode some object in SBOR. SborEncodeError { message: String, @@ -90,6 +82,17 @@ pub enum Error { message: String, }, + /// Represents an error when attempting to decode some SBOR payload. This error means that + /// the prefix byte (the first byte of the payload) was found to be incompatible or incorrect + /// with what the toolkit supports. + InvalidSborPrefix { + expected: Vec, + found: u8, + }, + + /// Emitted when trying to decode an empty payload + EmptyPayloadError, + // ==== // AST // ==== @@ -98,14 +101,14 @@ pub enum Error { /// we attempt to parse a `Decimal` and instead of the internals being a string we find some /// other type (e.g. `Decimal(Bucket(12)))`, then this error is emitted. UnexpectedAstContents { - parsing: ValueKind, - expected: Vec, - found: ValueKind, + parsing: ManifestAstValueKind, + expected: Vec, + found: ManifestAstValueKind, }, /// An error emitted when the parsing of a value from string fails. ParseError { - kind: ValueKind, + kind: ManifestAstValueKind, message: String, }, @@ -169,6 +172,38 @@ pub enum Error { Infallible { message: String, }, + + /// A conversion which is invalid and can not be made. + InvalidConversion, + + // ================ + // Analysis Errors + // ================ + NoResourceChangesForInstruction { + instruction_index: u32, + }, + + /// An error emitted when a bucket with a given id could not be found. + InvalidBucketId { + bucket_id: BucketId, + }, + + /// An error emitted when a bucket is created with an identical identifier to one that already + /// exists. + BucketExistsError { + bucket_id: BucketId, + }, + + /// An error emitted when a transaction failed. + TransactionRejectionOrCommitFailure, + + /// An error emitted when the passed address is not believed to be an Olympia address. + NotAnOlympiaAddress { + address: String, + }, + + /// Transaction was not committed. + TransactionNotCommitted, } impl Display for Error { @@ -196,7 +231,7 @@ macro_rules! generate_from_error { } generate_from_error!(hex::FromHexError as FailedToDecodeHex); -generate_from_error!(scrypto::radix_engine_interface::address::AddressError as AddressError); +generate_from_error!(scrypto::address::AddressError as AddressError); generate_from_error!(sbor::EncodeError as SborEncodeError); generate_from_error!(sbor::DecodeError as SborDecodeError); generate_from_error!(native_transaction::manifest::CompileError as ManifestCompileError); @@ -205,9 +240,7 @@ generate_from_error!(std::str::Utf8Error as InvalidRequestString); generate_from_error!( native_transaction::manifest::generator::GeneratorError as ManifestGenerationError ); -generate_from_error!( - scrypto::radix_engine_interface::model::ContentValidationError as ContentValidationError -); +generate_from_error!(scrypto::runtime::ContentValidationError as ContentValidationError); macro_rules! impl_from_parse_error { ($($error_type: ty => $kind: ident,)*) => { @@ -215,7 +248,7 @@ macro_rules! impl_from_parse_error { impl From<$error_type> for Error { fn from(error: $error_type) -> Self { Self::ParseError { - kind: ValueKind::$kind, + kind: ManifestAstValueKind::$kind, message: format!("{:?}", error) } } @@ -227,14 +260,9 @@ macro_rules! impl_from_parse_error { impl_from_parse_error! { scrypto::prelude::ParseDecimalError => Decimal, scrypto::prelude::ParsePreciseDecimalError => PreciseDecimal, - scrypto::prelude::ParseHashError => Hash, scrypto::prelude::ParseNonFungibleLocalIdError => NonFungibleLocalId, scrypto::prelude::ParseNonFungibleGlobalIdError => NonFungibleGlobalId, scrypto::prelude::ParseManifestBlobRefError => Blob, - scrypto::prelude::ParseEcdsaSecp256k1PublicKeyError => EcdsaSecp256k1PublicKey, - scrypto::prelude::ParseEcdsaSecp256k1SignatureError => EcdsaSecp256k1Signature, - scrypto::prelude::ParseEddsaEd25519PublicKeyError => EddsaEd25519PublicKey, - scrypto::prelude::ParseEddsaEd25519SignatureError => EddsaEd25519Signature, } /// The result type used by the Radix Engine Toolkit where all errors are of a single type. diff --git a/radix-engine-toolkit/src/example/address/entity_address.rs b/radix-engine-toolkit/src/example/address/entity_address.rs new file mode 100644 index 00000000..598aa42a --- /dev/null +++ b/radix-engine-toolkit/src/example/address/entity_address.rs @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use scrypto::prelude::{FAUCET_COMPONENT, FAUCET_PACKAGE, RADIX_TOKEN}; + +use crate::model::address::{ + EntityAddress, NetworkAwareComponentAddress, NetworkAwarePackageAddress, + NetworkAwareResourceAddress, +}; + +pub fn entity_component_address() -> EntityAddress { + EntityAddress::ComponentAddress { + address: component_address(), + } +} + +pub fn entity_resource_address() -> EntityAddress { + EntityAddress::ResourceAddress { + address: resource_address(), + } +} + +pub fn entity_package_address() -> EntityAddress { + EntityAddress::PackageAddress { + address: package_address(), + } +} + +pub fn resource_address() -> NetworkAwareResourceAddress { + NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + } +} + +pub fn component_address() -> NetworkAwareComponentAddress { + NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + } +} + +pub fn package_address() -> NetworkAwarePackageAddress { + NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + } +} diff --git a/radix-engine-toolkit/src/example/address/mod.rs b/radix-engine-toolkit/src/example/address/mod.rs new file mode 100644 index 00000000..72df4c21 --- /dev/null +++ b/radix-engine-toolkit/src/example/address/mod.rs @@ -0,0 +1,19 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod entity_address; +pub mod non_fungible; diff --git a/radix-engine-toolkit/src/example/address/non_fungible.rs b/radix-engine-toolkit/src/example/address/non_fungible.rs new file mode 100644 index 00000000..c4e9b8e2 --- /dev/null +++ b/radix-engine-toolkit/src/example/address/non_fungible.rs @@ -0,0 +1,86 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::model::address::{NetworkAwareResourceAddress, NonFungibleGlobalId, NonFungibleLocalId}; +use scrypto::prelude::{ + BytesNonFungibleLocalId, IntegerNonFungibleLocalId, StringNonFungibleLocalId, + UUIDNonFungibleLocalId, ECDSA_SECP256K1_TOKEN, +}; + +pub fn non_fungible_local_uuid() -> NonFungibleLocalId { + NonFungibleLocalId::UUID(241008287272164729465721528295504357972) +} + +pub fn non_fungible_local_integer() -> NonFungibleLocalId { + NonFungibleLocalId::Integer(1) +} + +pub fn non_fungible_local_string() -> NonFungibleLocalId { + NonFungibleLocalId::String("Scrypto".into()) +} + +pub fn non_fungible_local_bytes() -> NonFungibleLocalId { + NonFungibleLocalId::Bytes(vec![0x00, 0x01, 0x02, 0x03]) +} + +pub fn non_fungible_global_uuid() -> NonFungibleGlobalId { + NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0x01, + address: ECDSA_SECP256K1_TOKEN, + }, + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::UUID( + UUIDNonFungibleLocalId::new(241008287272164729465721528295504357972).unwrap(), + ), + } +} + +pub fn non_fungible_global_integer() -> NonFungibleGlobalId { + NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0x01, + address: ECDSA_SECP256K1_TOKEN, + }, + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Integer( + IntegerNonFungibleLocalId::new(1), + ), + } +} + +pub fn non_fungible_global_string() -> NonFungibleGlobalId { + NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0x01, + address: ECDSA_SECP256K1_TOKEN, + }, + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::String( + StringNonFungibleLocalId::new("Scrypto".to_owned()).unwrap(), + ), + } +} + +pub fn non_fungible_global_bytes() -> NonFungibleGlobalId { + NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0x01, + address: ECDSA_SECP256K1_TOKEN, + }, + non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Bytes( + BytesNonFungibleLocalId::new(vec![0x01, 0x02, 0x03, 0x04]).unwrap(), + ), + } +} diff --git a/radix-engine-toolkit/src/example/crypto/mod.rs b/radix-engine-toolkit/src/example/crypto/mod.rs new file mode 100644 index 00000000..93b769b2 --- /dev/null +++ b/radix-engine-toolkit/src/example/crypto/mod.rs @@ -0,0 +1,66 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use native_transaction::{ + ecdsa_secp256k1::EcdsaSecp256k1PrivateKey, eddsa_ed25519::EddsaEd25519PrivateKey, +}; +use scrypto::prelude::hash; + +use crate::model::crypto::{PublicKey, Signature, SignatureWithPublicKey}; + +pub fn public_key1() -> PublicKey { + PublicKey::EcdsaSecp256k1 { + public_key: EcdsaSecp256k1PrivateKey::from_u64(1).unwrap().public_key(), + } +} + +pub fn public_key2() -> PublicKey { + PublicKey::EddsaEd25519 { + public_key: EddsaEd25519PrivateKey::from_u64(1).unwrap().public_key(), + } +} + +pub fn signature_with_public_key1() -> SignatureWithPublicKey { + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let message = vec![0x00, 0x01, 0x02, 0x03]; + let signature = private_key.sign(&hash(message)); + SignatureWithPublicKey::EcdsaSecp256k1 { signature } +} + +pub fn signature_with_public_key2() -> SignatureWithPublicKey { + let private_key = EddsaEd25519PrivateKey::from_u64(1).unwrap(); + let message = vec![0x00, 0x01, 0x02, 0x03]; + let signature = private_key.sign(&hash(message)); + SignatureWithPublicKey::EddsaEd25519 { + public_key: private_key.public_key(), + signature, + } +} + +pub fn signature1() -> Signature { + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let message = vec![0x00, 0x01, 0x02, 0x03]; + let signature = private_key.sign(&hash(message)); + Signature::EcdsaSecp256k1 { signature } +} + +pub fn signature2() -> Signature { + let private_key = EddsaEd25519PrivateKey::from_u64(1).unwrap(); + let message = vec![0x00, 0x01, 0x02, 0x03]; + let signature = private_key.sign(&hash(message)); + Signature::EddsaEd25519 { signature } +} diff --git a/radix-engine-toolkit/src/example/engine_identifier/mod.rs b/radix-engine-toolkit/src/example/engine_identifier/mod.rs new file mode 100644 index 00000000..ad671178 --- /dev/null +++ b/radix-engine-toolkit/src/example/engine_identifier/mod.rs @@ -0,0 +1,18 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod transient_identifier; diff --git a/radix-engine-toolkit/src/example/engine_identifier/transient_identifier.rs b/radix-engine-toolkit/src/example/engine_identifier/transient_identifier.rs new file mode 100644 index 00000000..9b1ffd49 --- /dev/null +++ b/radix-engine-toolkit/src/example/engine_identifier/transient_identifier.rs @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::model::engine_identifier::{BucketId, ProofId, TransientIdentifier}; + +pub fn string() -> TransientIdentifier { + TransientIdentifier::String { + value: "Scrypto".into(), + } +} + +pub fn u32() -> TransientIdentifier { + TransientIdentifier::U32 { value: 1 } +} + +pub fn bucket_id1() -> BucketId { + BucketId(string()) +} + +pub fn bucket_id2() -> BucketId { + BucketId(u32()) +} + +pub fn proof_id1() -> ProofId { + ProofId(string()) +} + +pub fn proof_id2() -> ProofId { + ProofId(u32()) +} diff --git a/radix-engine-toolkit/src/example/instruction.rs b/radix-engine-toolkit/src/example/instruction.rs new file mode 100644 index 00000000..666e3401 --- /dev/null +++ b/radix-engine-toolkit/src/example/instruction.rs @@ -0,0 +1,1270 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use native_transaction::manifest::generator::{generate_instruction, NameResolver}; +use native_transaction::validation::ManifestValidator; +use scrypto::prelude::{ + Hash, IntegerNonFungibleLocalId, ManifestBlobRef, FAUCET_COMPONENT, FAUCET_PACKAGE, RADIX_TOKEN, +}; + +use crate::model::address::{ + EntityAddress, NetworkAwareComponentAddress, NetworkAwarePackageAddress, + NetworkAwareResourceAddress, +}; +use crate::model::engine_identifier::{BucketId, ProofId, TransientIdentifier}; +use crate::model::value::ast::{EnumDiscriminator, ManifestAstValue, ManifestAstValueKind}; +use crate::model::{address::Bech32Coder, instruction::Instruction, transaction::InstructionList}; +use crate::utils::checked_copy_u8_slice; + +pub fn call_function1() -> Instruction { + let instruction = Instruction::CallFunction { + package_address: ManifestAstValue::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + }, + }, + }, + blueprint_name: ManifestAstValue::String { + value: "Faucet".into(), + }, + function_name: ManifestAstValue::String { + value: "new".to_owned(), + }, + arguments: Some(vec![ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }]), + }; + check_instruction(&instruction); + instruction +} + +pub fn call_function2() -> Instruction { + let instruction = Instruction::CallFunction { + package_address: ManifestAstValue::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + }, + }, + }, + blueprint_name: ManifestAstValue::String { + value: "Faucet".into(), + }, + function_name: ManifestAstValue::String { + value: "new".to_owned(), + }, + arguments: Some(vec![ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }]), + }; + check_instruction(&instruction); + instruction +} + +pub fn call_function3() -> Instruction { + let instruction = Instruction::CallFunction { + package_address: ManifestAstValue::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + }, + }, + }, + blueprint_name: ManifestAstValue::String { + value: "Faucet".into(), + }, + function_name: ManifestAstValue::String { + value: "new".to_owned(), + }, + arguments: Some(vec![ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }]), + }; + check_instruction(&instruction); + instruction +} + +pub fn call_function4() -> Instruction { + let instruction = Instruction::CallFunction { + package_address: ManifestAstValue::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + }, + }, + }, + blueprint_name: ManifestAstValue::String { + value: "Faucet".into(), + }, + function_name: ManifestAstValue::String { + value: "new".to_owned(), + }, + arguments: Some(vec![ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }]), + }; + check_instruction(&instruction); + instruction +} + +pub fn call_method1() -> Instruction { + let instruction = Instruction::CallMethod { + component_address: ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + }, + method_name: ManifestAstValue::String { + value: "free".into(), + }, + arguments: Some(vec![ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }]), + }; + check_instruction(&instruction); + instruction +} + +pub fn call_method2() -> Instruction { + let instruction = Instruction::CallMethod { + component_address: ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + }, + method_name: ManifestAstValue::String { + value: "free".into(), + }, + arguments: Some(vec![ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }]), + }; + check_instruction(&instruction); + instruction +} + +pub fn call_method3() -> Instruction { + let instruction = Instruction::CallMethod { + component_address: ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + }, + method_name: ManifestAstValue::String { + value: "free".into(), + }, + arguments: None, + }; + check_instruction(&instruction); + instruction +} + +pub fn call_method4() -> Instruction { + let instruction = Instruction::CallMethod { + component_address: ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + }, + method_name: ManifestAstValue::String { + value: "free".into(), + }, + arguments: None, + }; + check_instruction(&instruction); + instruction +} + +pub fn take_from_worktop1() -> Instruction { + let instruction = Instruction::TakeFromWorktop { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + address: RADIX_TOKEN, + network_id: 0x01, + }, + }, + }, + into_bucket: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "ident".to_owned(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn take_from_worktop2() -> Instruction { + let instruction = Instruction::TakeFromWorktop { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + address: RADIX_TOKEN, + network_id: 0x01, + }, + }, + }, + into_bucket: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "ident".to_owned(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn take_from_worktop_by_amount1() -> Instruction { + let instruction = Instruction::TakeFromWorktopByAmount { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + amount: ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }, + into_bucket: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn take_from_worktop_by_amount2() -> Instruction { + let instruction = Instruction::TakeFromWorktopByAmount { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + amount: ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }, + into_bucket: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn take_from_worktop_by_ids1() -> Instruction { + let instruction = Instruction::TakeFromWorktopByIds { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + ids: vec![ManifestAstValue::NonFungibleLocalId { + value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + }], + into_bucket: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn take_from_worktop_by_ids2() -> Instruction { + let instruction = Instruction::TakeFromWorktopByIds { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + ids: vec![ManifestAstValue::NonFungibleLocalId { + value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + }], + into_bucket: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn return_to_worktop() -> Instruction { + let instruction = Instruction::ReturnToWorktop { + bucket: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn assert_worktop_contains1() -> Instruction { + let instruction = Instruction::AssertWorktopContains { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + address: RADIX_TOKEN, + network_id: 0x01, + }, + }, + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn assert_worktop_contains2() -> Instruction { + let instruction = Instruction::AssertWorktopContains { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + address: RADIX_TOKEN, + network_id: 0x01, + }, + }, + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn assert_worktop_contains_by_amount1() -> Instruction { + let instruction = Instruction::AssertWorktopContainsByAmount { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + amount: ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn assert_worktop_contains_by_amount2() -> Instruction { + let instruction = Instruction::AssertWorktopContainsByAmount { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + amount: ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn assert_worktop_contains_by_ids1() -> Instruction { + let instruction = Instruction::AssertWorktopContainsByIds { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + ids: vec![ManifestAstValue::NonFungibleLocalId { + value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + }], + }; + check_instruction(&instruction); + instruction +} + +pub fn assert_worktop_contains_by_ids2() -> Instruction { + let instruction = Instruction::AssertWorktopContainsByIds { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + ids: vec![ManifestAstValue::NonFungibleLocalId { + value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + }], + }; + check_instruction(&instruction); + instruction +} + +pub fn pop_from_auth_zone() -> Instruction { + let instruction = Instruction::PopFromAuthZone { + into_proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn push_to_auth_zone() -> Instruction { + let instruction = Instruction::PushToAuthZone { + proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn clear_auth_zone() -> Instruction { + let instruction = Instruction::ClearAuthZone; + check_instruction(&instruction); + instruction +} + +pub fn create_proof_from_auth_zone1() -> Instruction { + let instruction = Instruction::CreateProofFromAuthZone { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + address: RADIX_TOKEN, + network_id: 0x01, + }, + }, + }, + into_proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident".to_owned(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_proof_from_auth_zone2() -> Instruction { + let instruction = Instruction::CreateProofFromAuthZone { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + address: RADIX_TOKEN, + network_id: 0x01, + }, + }, + }, + into_proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident".to_owned(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_proof_from_auth_zone_by_amount1() -> Instruction { + let instruction = Instruction::CreateProofFromAuthZoneByAmount { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + amount: ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }, + into_proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_proof_from_auth_zone_by_amount2() -> Instruction { + let instruction = Instruction::CreateProofFromAuthZoneByAmount { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + amount: ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }, + into_proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_proof_from_auth_zone_by_ids1() -> Instruction { + let instruction = Instruction::CreateProofFromAuthZoneByIds { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + ids: vec![ManifestAstValue::NonFungibleLocalId { + value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + }], + into_proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_proof_from_auth_zone_by_ids2() -> Instruction { + let instruction = Instruction::CreateProofFromAuthZoneByIds { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + }, + ids: vec![ManifestAstValue::NonFungibleLocalId { + value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + }], + into_proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_proof_from_bucket() -> Instruction { + let instruction = Instruction::CreateProofFromBucket { + bucket: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "bucket".into(), + }), + }, + into_proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "Proof".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn clone_proof() -> Instruction { + let instruction = Instruction::CloneProof { + proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + into_proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "ident2".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn publish_package() -> Instruction { + let instruction = Instruction::PublishPackage { + code: ManifestAstValue::Blob { + hash: ManifestBlobRef( + checked_copy_u8_slice( + hex::decode("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") + .unwrap(), + ) + .unwrap(), + ), + }, + schema: ManifestAstValue::Blob { + hash: ManifestBlobRef( + checked_copy_u8_slice( + hex::decode("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") + .unwrap(), + ) + .unwrap(), + ), + }, + royalty_config: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::Tuple, + entries: Vec::new(), + }, + metadata: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::String, + entries: Vec::new(), + }, + access_rules: ManifestAstValue::Tuple { + elements: vec![ + ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::Tuple, + value_value_kind: ManifestAstValueKind::Enum, + entries: vec![], + }, + ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::Enum, + entries: vec![], + }, + ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::Tuple, + value_value_kind: ManifestAstValueKind::Enum, + entries: vec![], + }, + ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::Enum, + entries: vec![], + }, + ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + ], + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn burn_resource() -> Instruction { + let instruction = Instruction::BurnResource { + bucket: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn drop_all_proofs() -> Instruction { + let instruction = Instruction::DropAllProofs; + check_instruction(&instruction); + instruction +} + +pub fn drop_proof() -> Instruction { + let instruction = Instruction::DropProof { + proof: ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "proof".into(), + }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn recall_resource() -> Instruction { + let instruction = Instruction::RecallResource { + vault_id: ManifestAstValue::Bytes { + value: hex::decode("a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492") + .unwrap(), + }, + amount: ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn set_metadata() -> Instruction { + let instruction = Instruction::SetMetadata { + entity_address: ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + }, + key: ManifestAstValue::String { + value: "name".into(), + }, + value: ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0u8 }, + fields: Some(vec![ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0u8 }, + fields: Some(vec![ManifestAstValue::String { + value: "deadbeef".into(), + }]), + }]), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn remove_metadata() -> Instruction { + let instruction = Instruction::RemoveMetadata { + entity_address: ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + }, + key: ManifestAstValue::String { + value: "name".into(), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn set_package_royalty_config() -> Instruction { + let instruction = Instruction::SetPackageRoyaltyConfig { + package_address: ManifestAstValue::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + }, + }, + }, + royalty_config: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::Tuple, + entries: Vec::new(), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn set_component_royalty_config() -> Instruction { + let instruction = Instruction::SetComponentRoyaltyConfig { + component_address: ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + }, + royalty_config: ManifestAstValue::Tuple { + elements: vec![ + ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::U32, + entries: vec![], + }, + ManifestAstValue::U32 { value: 1 }, + ], + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn claim_package_royalty() -> Instruction { + let instruction = Instruction::ClaimPackageRoyalty { + package_address: ManifestAstValue::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + }, + }, + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn claim_component_royalty() -> Instruction { + let instruction = Instruction::ClaimComponentRoyalty { + component_address: ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn set_method_access_rule() -> Instruction { + let instruction = Instruction::SetMethodAccessRule { + entity_address: ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + }, + key: ManifestAstValue::Tuple { + elements: vec![ + ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + ManifestAstValue::String { + value: "free".to_owned(), + }, + ], + }, + rule: ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn mint_fungible() -> Instruction { + let instruction = Instruction::MintFungible { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + }, + amount: ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn mint_non_fungible() -> Instruction { + let instruction = Instruction::MintNonFungible { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + }, + entries: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::NonFungibleLocalId, + value_value_kind: ManifestAstValueKind::Tuple, + entries: Vec::new(), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn mint_uuid_non_fungible() -> Instruction { + let instruction = Instruction::MintUuidNonFungible { + resource_address: ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0xf2, + address: RADIX_TOKEN, + }, + }, + }, + entries: ManifestAstValue::Array { + element_kind: ManifestAstValueKind::Tuple, + elements: vec![ + ManifestAstValue::Tuple { + elements: vec![ + ManifestAstValue::Tuple { elements: vec![] }, + ManifestAstValue::Tuple { elements: vec![] }, + ], + }, + ManifestAstValue::Tuple { + elements: vec![ + ManifestAstValue::Tuple { elements: vec![] }, + ManifestAstValue::Tuple { elements: vec![] }, + ], + }, + ], + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_fungible_resource() -> Instruction { + let instruction = Instruction::CreateFungibleResource { + divisibility: ManifestAstValue::U8 { value: 18 }, + metadata: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::String, + entries: Vec::new(), + }, + access_rules: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::Enum, + value_value_kind: ManifestAstValueKind::Tuple, + entries: Vec::new(), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_fungible_resource_with_initial_supply() -> Instruction { + let instruction = Instruction::CreateFungibleResourceWithInitialSupply { + divisibility: ManifestAstValue::U8 { value: 18 }, + metadata: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::String, + entries: Vec::new(), + }, + access_rules: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::Enum, + value_value_kind: ManifestAstValueKind::Tuple, + entries: Vec::new(), + }, + initial_supply: ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_non_fungible_resource() -> Instruction { + let instruction = Instruction::CreateNonFungibleResource { + id_type: ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + schema: ManifestAstValue::Tuple { + elements: vec![ + ManifestAstValue::Tuple { + elements: vec![ + ManifestAstValue::Array { + element_kind: ManifestAstValueKind::Enum, + elements: vec![], + }, + ManifestAstValue::Array { + element_kind: ManifestAstValueKind::Tuple, + elements: vec![], + }, + ManifestAstValue::Array { + element_kind: ManifestAstValueKind::Enum, + elements: vec![], + }, + ], + }, + ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: Some(vec![ManifestAstValue::U8 { value: 64 }]), + }, + ManifestAstValue::Array { + element_kind: ManifestAstValueKind::String, + elements: vec![], + }, + ], + }, + metadata: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::String, + entries: Vec::new(), + }, + access_rules: ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::Enum, + value_value_kind: ManifestAstValueKind::Tuple, + entries: Vec::new(), + }, + }; + check_instruction(&instruction); + instruction +} + +// TODO: Figure out correct representation. +// pub fn create_non_fungible_resource_with_initial_supply() -> Instruction { +// let instruction = Instruction::CreateNonFungibleResourceWithInitialSupply { +// id_type: ManifestAstValue::Enum { +// variant: EnumDiscriminator::U8 { discriminator: 0 }, +// fields: None, +// }, +// metadata: ManifestAstValue::Map { +// key_value_kind: ManifestAstValueKind::String, +// value_value_kind: ManifestAstValueKind::String, +// entries: Vec::new(), +// }, +// access_rules: ManifestAstValue::Map { +// key_value_kind: ManifestAstValueKind::Enum, +// value_value_kind: ManifestAstValueKind::Tuple, +// entries: Vec::new(), +// }, +// initial_supply: ManifestAstValue::Array { +// element_kind: ManifestAstValueKind::Array, +// elements: vec![], +// }, +// }; +// check_instruction(&instruction); +// instruction +// } + +pub fn create_access_controller() -> Instruction { + let instruction = Instruction::CreateAccessController { + controlled_asset: ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "ident".into(), + }), + }, + rule_set: ManifestAstValue::Tuple { + elements: vec![ + ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + ], + }, + timed_recovery_delay_in_minutes: ManifestAstValue::Some { + value: Box::new(ManifestAstValue::U32 { value: 1 }), + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_identity() -> Instruction { + let instruction = Instruction::CreateIdentity { + access_rule: ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn assert_access_rule() -> Instruction { + let instruction = Instruction::AssertAccessRule { + access_rule: ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_account() -> Instruction { + let instruction = Instruction::CreateAccount { + withdraw_rule: ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn create_validator() -> Instruction { + let instruction = Instruction::CreateValidator { + key: ManifestAstValue::Bytes { + value: hex::decode( + "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", + ) + .unwrap(), + }, + owner_access_rule: ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 0 }, + fields: None, + }, + }; + check_instruction(&instruction); + instruction +} + +pub fn clear_signature_proofs() -> Instruction { + let instruction = Instruction::ClearSignatureProofs; + check_instruction(&instruction); + instruction +} + +fn check_instruction(instruction: &Instruction) { + let bech32_coder = Bech32Coder::new(0x01); + let mut blobs = vec![]; + let mut name_resolver = NameResolver::new(); + let mut id_validator = ManifestValidator::new(); + + match instruction { + Instruction::PushToAuthZone { + proof: + ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { value }), + }, + } + | Instruction::CloneProof { + proof: + ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { value }), + }, + .. + } + | Instruction::DropProof { + proof: + ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { value }), + }, + } => { + name_resolver + .insert_proof( + value.to_string(), + id_validator + .new_proof(native_transaction::validation::ProofKind::AuthZoneProof) + .unwrap(), + ) + .unwrap(); + } + Instruction::ReturnToWorktop { + bucket: + ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { value }), + }, + } + | Instruction::CreateProofFromBucket { + bucket: + ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { value }), + }, + .. + } + | Instruction::BurnResource { + bucket: + ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { value }), + }, + } + | Instruction::CreateAccessController { + controlled_asset: + ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { value }), + }, + .. + } => name_resolver + .insert_bucket(value.to_string(), id_validator.new_bucket().unwrap()) + .unwrap(), + Instruction::PublishPackage { + code: ManifestAstValue::Blob { hash: code }, + schema: ManifestAstValue::Blob { hash: abi }, + .. + } => { + blobs.push(Hash(code.0)); + blobs.push(Hash(abi.0)); + } + _ => {} + } + + let instruction = InstructionList::Parsed(vec![instruction.clone()]) + .ast_instructions(&bech32_coder) + .unwrap()[0] + .clone(); + + generate_instruction( + &instruction, + &mut id_validator, + &mut name_resolver, + bech32_coder.decoder(), + &blobs.iter().map(|hash| (*hash, vec![])).collect(), + ) + .unwrap_or_else(|_| panic!("Failed at: {:?}", instruction)); +} diff --git a/radix-engine-toolkit/src/example/mod.rs b/radix-engine-toolkit/src/example/mod.rs new file mode 100644 index 00000000..7faa2cb5 --- /dev/null +++ b/radix-engine-toolkit/src/example/mod.rs @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +//! A module for model examples which provides them to the Schemars crate for inclusion in the JSON +//! Schema generated. + +pub mod address; +pub mod crypto; +pub mod engine_identifier; +pub mod instruction; +pub mod transaction; +pub mod value; diff --git a/radix-engine-toolkit/src/example/transaction/header.rs b/radix-engine-toolkit/src/example/transaction/header.rs new file mode 100644 index 00000000..cd030677 --- /dev/null +++ b/radix-engine-toolkit/src/example/transaction/header.rs @@ -0,0 +1,56 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use native_transaction::{ + ecdsa_secp256k1::EcdsaSecp256k1PrivateKey, eddsa_ed25519::EddsaEd25519PrivateKey, +}; + +use crate::model::transaction::TransactionHeader; + +pub fn header1() -> TransactionHeader { + TransactionHeader { + version: 0x01, + network_id: 0x01, + start_epoch_inclusive: 100, + end_epoch_exclusive: 105, + nonce: 5144, + notary_public_key: EcdsaSecp256k1PrivateKey::from_u64(1) + .unwrap() + .public_key() + .into(), + notary_as_signatory: false, + cost_unit_limit: 100_000_000, + tip_percentage: 12, + } +} + +pub fn header2() -> TransactionHeader { + TransactionHeader { + version: 0x01, + network_id: 0x01, + start_epoch_inclusive: 100, + end_epoch_exclusive: 105, + nonce: 5144, + notary_public_key: EddsaEd25519PrivateKey::from_u64(1) + .unwrap() + .public_key() + .into(), + notary_as_signatory: false, + cost_unit_limit: 100_000_000, + tip_percentage: 12, + } +} diff --git a/radix-engine-toolkit/src/example/transaction/instruction_list.rs b/radix-engine-toolkit/src/example/transaction/instruction_list.rs new file mode 100644 index 00000000..a4bfc677 --- /dev/null +++ b/radix-engine-toolkit/src/example/transaction/instruction_list.rs @@ -0,0 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::model::{instruction::Instruction, transaction::InstructionList}; + +pub fn string() -> InstructionList { + InstructionList::String("DROP_ALL_PROOFS;".to_owned()) +} + +pub fn parsed() -> InstructionList { + InstructionList::Parsed(vec![Instruction::DropAllProofs]) +} diff --git a/radix-engine-toolkit/src/example/transaction/mod.rs b/radix-engine-toolkit/src/example/transaction/mod.rs new file mode 100644 index 00000000..85a8929c --- /dev/null +++ b/radix-engine-toolkit/src/example/transaction/mod.rs @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod header; +pub mod instruction_list; +pub mod transaction_structure; diff --git a/radix-engine-toolkit/src/example/transaction/transaction_structure.rs b/radix-engine-toolkit/src/example/transaction/transaction_structure.rs new file mode 100644 index 00000000..8ffa91c9 --- /dev/null +++ b/radix-engine-toolkit/src/example/transaction/transaction_structure.rs @@ -0,0 +1,92 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use native_transaction::{ + builder::TransactionBuilder, ecdsa_secp256k1::EcdsaSecp256k1PrivateKey, + eddsa_ed25519::EddsaEd25519PrivateKey, +}; + +use crate::model::transaction::{ + InstructionKind, InstructionList, NotarizedTransaction, SignedTransactionIntent, + TransactionIntent, TransactionManifest, +}; + +use super::header::header1; + +pub fn manifest() -> TransactionManifest { + TransactionManifest { + instructions: InstructionList::String("DROP_ALL_PROOFS;".to_owned()), + blobs: vec![], + } +} + +pub fn intent() -> TransactionIntent { + TransactionIntent { + header: header1(), + manifest: manifest(), + } +} + +pub fn signed_intent() -> SignedTransactionIntent { + let notary_private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let intent = intent(); + + let native_intent = intent.to_native_transaction_intent().unwrap(); + let transaction = TransactionBuilder::new() + .header(native_intent.header) + .manifest(native_intent.manifest) + .sign(&EcdsaSecp256k1PrivateKey::from_u64(2).unwrap()) + .sign(&EcdsaSecp256k1PrivateKey::from_u64(3).unwrap()) + .sign(&EcdsaSecp256k1PrivateKey::from_u64(4).unwrap()) + .sign(&EcdsaSecp256k1PrivateKey::from_u64(5).unwrap()) + .sign(&EddsaEd25519PrivateKey::from_u64(2).unwrap()) + .sign(&EddsaEd25519PrivateKey::from_u64(3).unwrap()) + .sign(&EddsaEd25519PrivateKey::from_u64(4).unwrap()) + .sign(&EddsaEd25519PrivateKey::from_u64(5).unwrap()) + .notarize(¬ary_private_key) + .build(); + SignedTransactionIntent::from_native_signed_transaction_intent( + &transaction.signed_intent, + InstructionKind::Parsed, + ) + .unwrap() +} + +pub fn notarized_intent() -> NotarizedTransaction { + let notary_private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let intent = intent(); + + let native_intent = intent.to_native_transaction_intent().unwrap(); + let transaction = TransactionBuilder::new() + .header(native_intent.header) + .manifest(native_intent.manifest) + .sign(&EcdsaSecp256k1PrivateKey::from_u64(2).unwrap()) + .sign(&EcdsaSecp256k1PrivateKey::from_u64(3).unwrap()) + .sign(&EcdsaSecp256k1PrivateKey::from_u64(4).unwrap()) + .sign(&EcdsaSecp256k1PrivateKey::from_u64(5).unwrap()) + .sign(&EddsaEd25519PrivateKey::from_u64(2).unwrap()) + .sign(&EddsaEd25519PrivateKey::from_u64(3).unwrap()) + .sign(&EddsaEd25519PrivateKey::from_u64(4).unwrap()) + .sign(&EddsaEd25519PrivateKey::from_u64(5).unwrap()) + .notarize(¬ary_private_key) + .build(); + NotarizedTransaction::from_native_notarized_transaction_intent( + &transaction, + InstructionKind::Parsed, + ) + .unwrap() +} diff --git a/radix-engine-toolkit/src/example/value/ast_value.rs b/radix-engine-toolkit/src/example/value/ast_value.rs new file mode 100644 index 00000000..79474762 --- /dev/null +++ b/radix-engine-toolkit/src/example/value/ast_value.rs @@ -0,0 +1,376 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use scrypto::prelude::{ + BytesNonFungibleLocalId, IntegerNonFungibleLocalId, NonFungibleLocalId, + StringNonFungibleLocalId, UUIDNonFungibleLocalId, ECDSA_SECP256K1_TOKEN, FAUCET_COMPONENT, + FAUCET_PACKAGE, RADIX_TOKEN, +}; +use scrypto::prelude::{ManifestBlobRef, ManifestExpression}; + +use crate::model::address::*; +use crate::model::engine_identifier::{BucketId, ProofId, TransientIdentifier}; +use crate::model::value::ast::model::ManifestAstValue; +use crate::model::value::ast::{EnumDiscriminator, ManifestAstValueKind}; +use crate::utils::checked_copy_u8_slice; + +pub fn value() -> ManifestAstValue { + ManifestAstValue::Bool { value: false } +} + +pub fn bool1() -> ManifestAstValue { + ManifestAstValue::Bool { value: false } +} + +pub fn bool2() -> ManifestAstValue { + ManifestAstValue::Bool { value: true } +} + +pub fn u8() -> ManifestAstValue { + ManifestAstValue::U8 { value: 1 } +} + +pub fn u16() -> ManifestAstValue { + ManifestAstValue::U16 { value: 1 } +} + +pub fn u32() -> ManifestAstValue { + ManifestAstValue::U32 { value: 1 } +} + +pub fn u64() -> ManifestAstValue { + ManifestAstValue::U64 { value: 1 } +} + +pub fn u128() -> ManifestAstValue { + ManifestAstValue::U128 { value: 1 } +} + +pub fn i8() -> ManifestAstValue { + ManifestAstValue::I8 { value: 1 } +} + +pub fn i16() -> ManifestAstValue { + ManifestAstValue::I16 { value: 1 } +} + +pub fn i32() -> ManifestAstValue { + ManifestAstValue::I32 { value: 1 } +} + +pub fn i64() -> ManifestAstValue { + ManifestAstValue::I64 { value: 1 } +} + +pub fn i128() -> ManifestAstValue { + ManifestAstValue::I128 { value: 1 } +} + +pub fn string() -> ManifestAstValue { + ManifestAstValue::String { + value: "Scrypto".into(), + } +} + +pub fn enum1() -> ManifestAstValue { + ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 1 }, + fields: None, + } +} + +pub fn enum2() -> ManifestAstValue { + ManifestAstValue::Enum { + variant: EnumDiscriminator::String { + discriminator: "EnumName::Variant".into(), + }, + fields: None, + } +} + +pub fn enum3() -> ManifestAstValue { + ManifestAstValue::Enum { + variant: EnumDiscriminator::U8 { discriminator: 1 }, + fields: Some(vec![ManifestAstValue::U8 { value: 1 }]), + } +} + +pub fn enum4() -> ManifestAstValue { + ManifestAstValue::Enum { + variant: EnumDiscriminator::String { + discriminator: "EnumName::Variant".into(), + }, + fields: Some(vec![ManifestAstValue::U8 { value: 1 }]), + } +} + +pub fn some() -> ManifestAstValue { + ManifestAstValue::Some { + value: Box::new(ManifestAstValue::U8 { value: 1 }), + } +} + +pub fn none() -> ManifestAstValue { + ManifestAstValue::None +} + +pub fn ok() -> ManifestAstValue { + ManifestAstValue::Ok { + value: Box::new(ManifestAstValue::U8 { value: 1 }), + } +} + +pub fn err() -> ManifestAstValue { + ManifestAstValue::Err { + value: Box::new(ManifestAstValue::U8 { value: 1 }), + } +} + +pub fn array() -> ManifestAstValue { + ManifestAstValue::Array { + element_kind: ManifestAstValueKind::U8, + elements: vec![ + ManifestAstValue::U8 { value: 1 }, + ManifestAstValue::U8 { value: 2 }, + ManifestAstValue::U8 { value: 3 }, + ], + } +} + +pub fn map() -> ManifestAstValue { + ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::U8, + value_value_kind: ManifestAstValueKind::String, + entries: vec![ + ( + ManifestAstValue::U8 { value: 65 }, + ManifestAstValue::String { + value: "A".to_owned(), + }, + ), + ( + ManifestAstValue::U8 { value: 66 }, + ManifestAstValue::String { + value: "B".to_owned(), + }, + ), + ], + } +} + +pub fn tuple() -> ManifestAstValue { + ManifestAstValue::Tuple { + elements: vec![ManifestAstValue::Tuple { + elements: vec![ + ManifestAstValue::U8 { value: 1 }, + ManifestAstValue::String { + value: "Something".to_owned(), + }, + ], + }], + } +} + +pub fn decimal() -> ManifestAstValue { + ManifestAstValue::Decimal { + value: "1".parse().unwrap(), + } +} + +pub fn precise_decimal() -> ManifestAstValue { + ManifestAstValue::PreciseDecimal { + value: "1".parse().unwrap(), + } +} + +pub fn address1() -> ManifestAstValue { + ManifestAstValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + } +} + +pub fn address2() -> ManifestAstValue { + ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + } +} + +pub fn address3() -> ManifestAstValue { + ManifestAstValue::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + }, + }, + } +} + +pub fn bucket1() -> ManifestAstValue { + ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::String { + value: "bucket".to_owned(), + }), + } +} + +pub fn bucket2() -> ManifestAstValue { + ManifestAstValue::Bucket { + identifier: BucketId(TransientIdentifier::U32 { value: 1 }), + } +} + +pub fn proof1() -> ManifestAstValue { + ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::String { + value: "proof".to_owned(), + }), + } +} + +pub fn proof2() -> ManifestAstValue { + ManifestAstValue::Proof { + identifier: ProofId(TransientIdentifier::U32 { value: 1 }), + } +} + +pub fn non_fungible_local_id1() -> ManifestAstValue { + ManifestAstValue::NonFungibleLocalId { + value: NonFungibleLocalId::UUID( + UUIDNonFungibleLocalId::new(241008287272164729465721528295504357972).unwrap(), + ), + } +} + +pub fn non_fungible_local_id2() -> ManifestAstValue { + ManifestAstValue::NonFungibleLocalId { + value: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + } +} + +pub fn non_fungible_local_id3() -> ManifestAstValue { + ManifestAstValue::NonFungibleLocalId { + value: NonFungibleLocalId::String( + StringNonFungibleLocalId::new("Scrypto".to_owned()).unwrap(), + ), + } +} + +pub fn non_fungible_local_id4() -> ManifestAstValue { + ManifestAstValue::NonFungibleLocalId { + value: NonFungibleLocalId::Bytes( + BytesNonFungibleLocalId::new(vec![0x01, 0x02, 0x03, 0x04]).unwrap(), + ), + } +} + +pub fn non_fungible_global_id1() -> ManifestAstValue { + ManifestAstValue::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0x01, + address: ECDSA_SECP256K1_TOKEN, + }, + non_fungible_local_id: NonFungibleLocalId::UUID( + UUIDNonFungibleLocalId::new(241008287272164729465721528295504357972).unwrap(), + ), + } +} + +pub fn non_fungible_global_id2() -> ManifestAstValue { + ManifestAstValue::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0x01, + address: ECDSA_SECP256K1_TOKEN, + }, + non_fungible_local_id: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + } +} + +pub fn non_fungible_global_id3() -> ManifestAstValue { + ManifestAstValue::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0x01, + address: ECDSA_SECP256K1_TOKEN, + }, + non_fungible_local_id: NonFungibleLocalId::String( + StringNonFungibleLocalId::new("Scrypto".to_owned()).unwrap(), + ), + } +} + +pub fn non_fungible_global_id4() -> ManifestAstValue { + ManifestAstValue::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: 0x01, + address: ECDSA_SECP256K1_TOKEN, + }, + non_fungible_local_id: NonFungibleLocalId::Bytes( + BytesNonFungibleLocalId::new(vec![0x01, 0x02, 0x03, 0x04]).unwrap(), + ), + } +} + +pub fn expression1() -> ManifestAstValue { + ManifestAstValue::Expression { + value: ManifestExpression::EntireAuthZone, + } +} + +pub fn expression2() -> ManifestAstValue { + ManifestAstValue::Expression { + value: ManifestExpression::EntireWorktop, + } +} + +pub fn blob() -> ManifestAstValue { + ManifestAstValue::Blob { + hash: ManifestBlobRef( + checked_copy_u8_slice( + hex::decode("d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e") + .unwrap(), + ) + .unwrap(), + ), + } +} + +pub fn bytes() -> ManifestAstValue { + ManifestAstValue::Bytes { + value: hex::decode("d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e") + .unwrap(), + } +} + +pub fn enum_discriminator1() -> EnumDiscriminator { + EnumDiscriminator::String { + discriminator: "EnumName::Variant".to_owned(), + } +} + +pub fn enum_discriminator2() -> EnumDiscriminator { + EnumDiscriminator::U8 { discriminator: 1 } +} diff --git a/radix-engine-toolkit/src/example/value/manifest_sbor_value.rs b/radix-engine-toolkit/src/example/value/manifest_sbor_value.rs new file mode 100644 index 00000000..a1a590bf --- /dev/null +++ b/radix-engine-toolkit/src/example/value/manifest_sbor_value.rs @@ -0,0 +1,251 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use scrypto::prelude::{ + BytesNonFungibleLocalId, IntegerNonFungibleLocalId, NonFungibleLocalId, + StringNonFungibleLocalId, UUIDNonFungibleLocalId, FAUCET_COMPONENT, FAUCET_PACKAGE, + RADIX_TOKEN, +}; +use scrypto::prelude::{ManifestBlobRef, ManifestExpression}; + +use crate::model::address::*; +use crate::model::value::manifest_sbor::{ManifestSborValue, ManifestSborValueKind}; +use crate::utils::checked_copy_u8_slice; + +pub fn value() -> ManifestSborValue { + ManifestSborValue::Bool { value: false } +} + +pub fn bool1() -> ManifestSborValue { + ManifestSborValue::Bool { value: false } +} + +pub fn bool2() -> ManifestSborValue { + ManifestSborValue::Bool { value: true } +} + +pub fn u8() -> ManifestSborValue { + ManifestSborValue::U8 { value: 1 } +} + +pub fn u16() -> ManifestSborValue { + ManifestSborValue::U16 { value: 1 } +} + +pub fn u32() -> ManifestSborValue { + ManifestSborValue::U32 { value: 1 } +} + +pub fn u64() -> ManifestSborValue { + ManifestSborValue::U64 { value: 1 } +} + +pub fn u128() -> ManifestSborValue { + ManifestSborValue::U128 { value: 1 } +} + +pub fn i8() -> ManifestSborValue { + ManifestSborValue::I8 { value: 1 } +} + +pub fn i16() -> ManifestSborValue { + ManifestSborValue::I16 { value: 1 } +} + +pub fn i32() -> ManifestSborValue { + ManifestSborValue::I32 { value: 1 } +} + +pub fn i64() -> ManifestSborValue { + ManifestSborValue::I64 { value: 1 } +} + +pub fn i128() -> ManifestSborValue { + ManifestSborValue::I128 { value: 1 } +} + +pub fn string() -> ManifestSborValue { + ManifestSborValue::String { + value: "Scrypto".into(), + } +} + +pub fn enum1() -> ManifestSborValue { + ManifestSborValue::Enum { + variant: 1, + fields: None, + } +} + +pub fn enum2() -> ManifestSborValue { + ManifestSborValue::Enum { + variant: 1, + fields: Some(vec![ManifestSborValue::U8 { value: 1 }]), + } +} + +pub fn array() -> ManifestSborValue { + ManifestSborValue::Array { + element_kind: ManifestSborValueKind::U8, + elements: vec![ + ManifestSborValue::U8 { value: 1 }, + ManifestSborValue::U8 { value: 2 }, + ManifestSborValue::U8 { value: 3 }, + ], + } +} + +pub fn map() -> ManifestSborValue { + ManifestSborValue::Map { + key_value_kind: ManifestSborValueKind::U8, + value_value_kind: ManifestSborValueKind::String, + entries: vec![ + ( + ManifestSborValue::U8 { value: 65 }, + ManifestSborValue::String { + value: "A".to_owned(), + }, + ), + ( + ManifestSborValue::U8 { value: 66 }, + ManifestSborValue::String { + value: "B".to_owned(), + }, + ), + ], + } +} + +pub fn tuple() -> ManifestSborValue { + ManifestSborValue::Tuple { + elements: vec![ManifestSborValue::Tuple { + elements: vec![ + ManifestSborValue::U8 { value: 1 }, + ManifestSborValue::String { + value: "Something".to_owned(), + }, + ], + }], + } +} + +pub fn decimal() -> ManifestSborValue { + ManifestSborValue::Decimal { + value: "1".parse().unwrap(), + } +} + +pub fn precise_decimal() -> ManifestSborValue { + ManifestSborValue::PreciseDecimal { + value: "1".parse().unwrap(), + } +} + +pub fn address1() -> ManifestSborValue { + ManifestSborValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + } +} + +pub fn address2() -> ManifestSborValue { + ManifestSborValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + } +} + +pub fn address3() -> ManifestSborValue { + ManifestSborValue::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + }, + }, + } +} + +pub fn bucket() -> ManifestSborValue { + ManifestSborValue::Bucket { identifier: 1 } +} + +pub fn proof() -> ManifestSborValue { + ManifestSborValue::Proof { identifier: 1 } +} + +pub fn non_fungible_local_id1() -> ManifestSborValue { + ManifestSborValue::NonFungibleLocalId { + value: NonFungibleLocalId::UUID( + UUIDNonFungibleLocalId::new(241008287272164729465721528295504357972).unwrap(), + ), + } +} + +pub fn non_fungible_local_id2() -> ManifestSborValue { + ManifestSborValue::NonFungibleLocalId { + value: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + } +} + +pub fn non_fungible_local_id3() -> ManifestSborValue { + ManifestSborValue::NonFungibleLocalId { + value: NonFungibleLocalId::String( + StringNonFungibleLocalId::new("Scrypto".to_owned()).unwrap(), + ), + } +} + +pub fn non_fungible_local_id4() -> ManifestSborValue { + ManifestSborValue::NonFungibleLocalId { + value: NonFungibleLocalId::Bytes( + BytesNonFungibleLocalId::new(vec![0x01, 0x02, 0x03, 0x04]).unwrap(), + ), + } +} + +pub fn expression1() -> ManifestSborValue { + ManifestSborValue::Expression { + value: ManifestExpression::EntireAuthZone, + } +} + +pub fn expression2() -> ManifestSborValue { + ManifestSborValue::Expression { + value: ManifestExpression::EntireWorktop, + } +} + +pub fn blob() -> ManifestSborValue { + ManifestSborValue::Blob { + hash: ManifestBlobRef( + checked_copy_u8_slice( + hex::decode("d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e") + .unwrap(), + ) + .unwrap(), + ), + } +} diff --git a/radix-engine-toolkit/src/example/value/mod.rs b/radix-engine-toolkit/src/example/value/mod.rs new file mode 100644 index 00000000..4e4a2677 --- /dev/null +++ b/radix-engine-toolkit/src/example/value/mod.rs @@ -0,0 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod ast_value; +pub mod manifest_sbor_value; +pub mod scrypto_sbor_value; diff --git a/radix-engine-toolkit/src/example/value/scrypto_sbor_value.rs b/radix-engine-toolkit/src/example/value/scrypto_sbor_value.rs new file mode 100644 index 00000000..a7b9df84 --- /dev/null +++ b/radix-engine-toolkit/src/example/value/scrypto_sbor_value.rs @@ -0,0 +1,255 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use radix_engine_common::data::scrypto::model::OBJECT_ID_LENGTH; +use scrypto::prelude::{ + BytesNonFungibleLocalId, IntegerNonFungibleLocalId, NonFungibleLocalId, Own, + StringNonFungibleLocalId, UUIDNonFungibleLocalId, FAUCET_COMPONENT, FAUCET_PACKAGE, + RADIX_TOKEN, +}; + +use crate::model::address::*; +use crate::model::engine_identifier::NodeIdentifier; +use crate::model::value::scrypto_sbor::{ScryptoSborValue, ScryptoSborValueKind}; + +pub fn value() -> ScryptoSborValue { + ScryptoSborValue::Bool { value: false } +} + +pub fn bool1() -> ScryptoSborValue { + ScryptoSborValue::Bool { value: false } +} + +pub fn bool2() -> ScryptoSborValue { + ScryptoSborValue::Bool { value: true } +} + +pub fn u8() -> ScryptoSborValue { + ScryptoSborValue::U8 { value: 1 } +} + +pub fn u16() -> ScryptoSborValue { + ScryptoSborValue::U16 { value: 1 } +} + +pub fn u32() -> ScryptoSborValue { + ScryptoSborValue::U32 { value: 1 } +} + +pub fn u64() -> ScryptoSborValue { + ScryptoSborValue::U64 { value: 1 } +} + +pub fn u128() -> ScryptoSborValue { + ScryptoSborValue::U128 { value: 1 } +} + +pub fn i8() -> ScryptoSborValue { + ScryptoSborValue::I8 { value: 1 } +} + +pub fn i16() -> ScryptoSborValue { + ScryptoSborValue::I16 { value: 1 } +} + +pub fn i32() -> ScryptoSborValue { + ScryptoSborValue::I32 { value: 1 } +} + +pub fn i64() -> ScryptoSborValue { + ScryptoSborValue::I64 { value: 1 } +} + +pub fn i128() -> ScryptoSborValue { + ScryptoSborValue::I128 { value: 1 } +} + +pub fn string() -> ScryptoSborValue { + ScryptoSborValue::String { + value: "Scrypto".into(), + } +} + +pub fn enum1() -> ScryptoSborValue { + ScryptoSborValue::Enum { + variant: 1u8, + fields: None, + } +} + +pub fn enum2() -> ScryptoSborValue { + ScryptoSborValue::Enum { + variant: 1u8, + fields: Some(vec![ScryptoSborValue::U8 { value: 1 }]), + } +} + +pub fn array() -> ScryptoSborValue { + ScryptoSborValue::Array { + element_kind: ScryptoSborValueKind::U8, + elements: vec![ + ScryptoSborValue::U8 { value: 1 }, + ScryptoSborValue::U8 { value: 2 }, + ScryptoSborValue::U8 { value: 3 }, + ], + } +} + +pub fn map() -> ScryptoSborValue { + ScryptoSborValue::Map { + key_value_kind: ScryptoSborValueKind::U8, + value_value_kind: ScryptoSborValueKind::String, + entries: vec![ + ( + ScryptoSborValue::U8 { value: 65 }, + ScryptoSborValue::String { + value: "A".to_owned(), + }, + ), + ( + ScryptoSborValue::U8 { value: 66 }, + ScryptoSborValue::String { + value: "B".to_owned(), + }, + ), + ], + } +} + +pub fn tuple() -> ScryptoSborValue { + ScryptoSborValue::Tuple { + elements: vec![ScryptoSborValue::Tuple { + elements: vec![ + ScryptoSborValue::U8 { value: 1 }, + ScryptoSborValue::String { + value: "Something".to_owned(), + }, + ], + }], + } +} + +pub fn decimal() -> ScryptoSborValue { + ScryptoSborValue::Decimal { + value: "1".parse().unwrap(), + } +} + +pub fn precise_decimal() -> ScryptoSborValue { + ScryptoSborValue::PreciseDecimal { + value: "1".parse().unwrap(), + } +} + +pub fn address1() -> ScryptoSborValue { + ScryptoSborValue::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id: 0x01, + address: FAUCET_COMPONENT, + }, + }, + } +} + +pub fn address2() -> ScryptoSborValue { + ScryptoSborValue::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id: 0x01, + address: RADIX_TOKEN, + }, + }, + } +} + +pub fn address3() -> ScryptoSborValue { + ScryptoSborValue::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id: 0x01, + address: FAUCET_PACKAGE, + }, + }, + } +} + +pub fn own1() -> ScryptoSborValue { + ScryptoSborValue::Own { + value: Own::Bucket([0; OBJECT_ID_LENGTH]), + } +} + +pub fn own2() -> ScryptoSborValue { + ScryptoSborValue::Own { + value: Own::Proof([0; OBJECT_ID_LENGTH]), + } +} + +pub fn own3() -> ScryptoSborValue { + ScryptoSborValue::Own { + value: Own::Vault([0; OBJECT_ID_LENGTH]), + } +} + +pub fn own4() -> ScryptoSborValue { + ScryptoSborValue::Own { + value: Own::Object([0; OBJECT_ID_LENGTH]), + } +} + +pub fn own5() -> ScryptoSborValue { + ScryptoSborValue::Own { + value: Own::KeyValueStore([0; OBJECT_ID_LENGTH]), + } +} + +pub fn non_fungible_local_id1() -> ScryptoSborValue { + ScryptoSborValue::NonFungibleLocalId { + value: NonFungibleLocalId::UUID( + UUIDNonFungibleLocalId::new(241008287272164729465721528295504357972).unwrap(), + ), + } +} + +pub fn non_fungible_local_id2() -> ScryptoSborValue { + ScryptoSborValue::NonFungibleLocalId { + value: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + } +} + +pub fn non_fungible_local_id3() -> ScryptoSborValue { + ScryptoSborValue::NonFungibleLocalId { + value: NonFungibleLocalId::String( + StringNonFungibleLocalId::new("Scrypto".to_owned()).unwrap(), + ), + } +} + +pub fn non_fungible_local_id4() -> ScryptoSborValue { + ScryptoSborValue::NonFungibleLocalId { + value: NonFungibleLocalId::Bytes( + BytesNonFungibleLocalId::new(vec![0x01, 0x02, 0x03, 0x04]).unwrap(), + ), + } +} + +pub fn reference() -> ScryptoSborValue { + ScryptoSborValue::Reference { + value: NodeIdentifier([0; OBJECT_ID_LENGTH]), + } +} diff --git a/radix-engine-toolkit/src/lib.rs b/radix-engine-toolkit/src/lib.rs index 5c38e0e3..3571073c 100644 --- a/radix-engine-toolkit/src/lib.rs +++ b/radix-engine-toolkit/src/lib.rs @@ -16,19 +16,10 @@ // under the License. pub mod buffer; -pub mod enum_discriminator; pub mod error; +pub mod example; pub mod model; pub mod request; pub mod traits; pub mod utils; pub mod visitor; - -pub use buffer::*; -pub use enum_discriminator::*; -pub use error::*; -pub use model::*; -pub use request::*; -pub use traits::*; -pub use utils::*; -pub use visitor::*; diff --git a/radix-engine-toolkit/src/model/address/coder.rs b/radix-engine-toolkit/src/model/address/coder.rs index adc3374a..17c99cd7 100644 --- a/radix-engine-toolkit/src/model/address/coder.rs +++ b/radix-engine-toolkit/src/model/address/coder.rs @@ -15,15 +15,17 @@ // specific language governing permissions and limitations // under the License. -use crate::address::network_aware_address::*; +use std::borrow::Borrow; + +use crate::error::Error; use crate::error::Result; +use crate::model::address::network_aware_address::*; use crate::utils::{ network_definition_from_network_id, network_id_from_address_string, network_id_from_hrp, }; -use crate::Error; +use scrypto::address::{Bech32Decoder, Bech32Encoder}; +use scrypto::network::NetworkDefinition; use scrypto::prelude::{ComponentAddress, PackageAddress, ResourceAddress}; -use scrypto::radix_engine_interface::address::{Bech32Decoder, Bech32Encoder}; -use scrypto::radix_engine_interface::node::NetworkDefinition; /// A Bech32m encoder and decoder used in the Radix Engine Toolkit for all of it's address encoding /// and decoding needs @@ -71,19 +73,25 @@ impl Bech32Coder { network_id_from_address_string(address).map(Self::new) } - pub fn encode_component_address(&self, component_address: &ComponentAddress) -> String { + pub fn encode_component_address>( + &self, + component_address: &A, + ) -> String { self.encoder - .encode_component_address_to_string(component_address) + .encode_component_address_to_string(component_address.borrow()) } - pub fn encode_resource_address(&self, resource_address: &ResourceAddress) -> String { + pub fn encode_resource_address>( + &self, + resource_address: A, + ) -> String { self.encoder - .encode_resource_address_to_string(resource_address) + .encode_resource_address_to_string(resource_address.borrow()) } - pub fn encode_package_address(&self, package_address: &PackageAddress) -> String { + pub fn encode_package_address>(&self, package_address: A) -> String { self.encoder - .encode_package_address_to_string(package_address) + .encode_package_address_to_string(package_address.borrow()) } pub fn decode_component_address>( diff --git a/radix-engine-toolkit/src/model/address/entity_address.rs b/radix-engine-toolkit/src/model/address/entity_address.rs index 49e07e12..d099748e 100644 --- a/radix-engine-toolkit/src/model/address/entity_address.rs +++ b/radix-engine-toolkit/src/model/address/entity_address.rs @@ -17,10 +17,12 @@ use crate::error::{Error, Result}; use crate::model::address::network_aware_address::*; -use scrypto::radix_engine_interface::address::EntityType; -use serializable::serializable; +use crate::model::address::Bech32Coder; +use scrypto::address::EntityType; +use scrypto::runtime::Address; use std::fmt::Display; use std::str::FromStr; +use toolkit_derive::serializable; // ================= // Model Definition @@ -30,9 +32,11 @@ use std::str::FromStr; /// string. #[serializable] #[serde(tag = "type")] +#[derive(Hash, Eq, PartialEq)] pub enum EntityAddress { /// Represents a Bech32m encoded human-readable component address. This address is serialized /// as a human-readable bech32m encoded string. + #[schemars(example = "crate::example::address::entity_address::entity_component_address")] ComponentAddress { #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] @@ -41,6 +45,7 @@ pub enum EntityAddress { /// Represents a Bech32m encoded human-readable resource address. This address is serialized /// as a human-readable bech32m encoded string. + #[schemars(example = "crate::example::address::entity_address::entity_resource_address")] ResourceAddress { #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] @@ -49,6 +54,7 @@ pub enum EntityAddress { /// Represents a Bech32m encoded human-readable package address. This address is serialized /// as a human-readable bech32m encoded string. + #[schemars(example = "crate::example::address::entity_address::entity_package_address")] PackageAddress { #[schemars(with = "String")] #[serde_as(as = "serde_with::DisplayFromStr")] @@ -56,6 +62,80 @@ pub enum EntityAddress { }, } +// =========== +// Conversion +// =========== + +impl From for Address { + fn from(value: EntityAddress) -> Self { + match value { + EntityAddress::ComponentAddress { address } => Self::Component(address.address), + EntityAddress::ResourceAddress { address } => Self::Resource(address.address), + EntityAddress::PackageAddress { address } => Self::Package(address.address), + } + } +} + +impl TryFrom for EntityAddress { + type Error = Error; + + fn try_from(address: NetworkAwareComponentAddress) -> Result { + Ok(Self::ComponentAddress { address }) + } +} + +impl TryFrom for EntityAddress { + type Error = Error; + + fn try_from(address: NetworkAwarePackageAddress) -> Result { + Ok(Self::PackageAddress { address }) + } +} + +impl TryFrom for EntityAddress { + type Error = Error; + + fn try_from(address: NetworkAwareResourceAddress) -> Result { + Ok(Self::ResourceAddress { address }) + } +} + +impl TryFrom for NetworkAwareComponentAddress { + type Error = Error; + + fn try_from(value: EntityAddress) -> Result { + if let EntityAddress::ComponentAddress { address } = value { + Ok(address) + } else { + Err(Error::InvalidConversion) + } + } +} + +impl TryFrom for NetworkAwareResourceAddress { + type Error = Error; + + fn try_from(value: EntityAddress) -> Result { + if let EntityAddress::ResourceAddress { address } = value { + Ok(address) + } else { + Err(Error::InvalidConversion) + } + } +} + +impl TryFrom for NetworkAwarePackageAddress { + type Error = Error; + + fn try_from(value: EntityAddress) -> Result { + if let EntityAddress::PackageAddress { address } = value { + Ok(address) + } else { + Err(Error::InvalidConversion) + } + } +} + // =============== // Implementation // =============== @@ -87,7 +167,10 @@ impl EntityAddress { scrypto::prelude::ComponentAddress::Validator(_) => EntityType::Validator, }, Self::ResourceAddress { address } => match address.address { - scrypto::prelude::ResourceAddress::Normal(_) => EntityType::Resource, + scrypto::prelude::ResourceAddress::Fungible(_) => EntityType::FungibleResource, + scrypto::prelude::ResourceAddress::NonFungible(_) => { + EntityType::NonFungibleResource + } }, Self::PackageAddress { address } => match address.address { scrypto::prelude::PackageAddress::Normal(_) => EntityType::Package, @@ -145,3 +228,26 @@ impl FromStr for EntityAddress { } } } + +impl EntityAddress { + pub fn to_string_with_encoder(&self, bech32_coder: &Bech32Coder) -> String { + match self { + Self::ComponentAddress { address } => bech32_coder.encode_component_address(address), + Self::ResourceAddress { address } => bech32_coder.encode_resource_address(*address), + Self::PackageAddress { address } => bech32_coder.encode_package_address(*address), + } + } + + pub fn from_str_with_coder>(s: S, bech32_coder: &Bech32Coder) -> Result { + if let Ok(address) = bech32_coder.decode_to_network_aware_component_address(s.as_ref()) { + Ok(Self::ComponentAddress { address }) + } else if let Ok(address) = bech32_coder.decode_to_network_aware_package_address(s.as_ref()) + { + Ok(Self::PackageAddress { address }) + } else if let Ok(address) = bech32_coder.decode_to_network_aware_resource_address(s) { + Ok(Self::ResourceAddress { address }) + } else { + Err(Error::UnrecognizedAddressFormat) + } + } +} diff --git a/radix-engine-toolkit/src/model/address/entity_type.rs b/radix-engine-toolkit/src/model/address/entity_type.rs index 13153bc0..3ca7d44f 100644 --- a/radix-engine-toolkit/src/model/address/entity_type.rs +++ b/radix-engine-toolkit/src/model/address/entity_type.rs @@ -15,8 +15,8 @@ // specific language governing permissions and limitations // under the License. -use scrypto::radix_engine_interface::address::EntityType as NativeEntityType; -use serializable::serializable; +use scrypto::address::EntityType as NativeEntityType; +use toolkit_derive::serializable; // ================= // Model Definition @@ -25,7 +25,8 @@ use serializable::serializable; /// An enum describing the different entity types in the Radix Engine and Scrypto #[serializable] pub enum EntityType { - Resource, + FungibleResource, + NonFungibleResource, Package, NormalComponent, AccountComponent, @@ -47,7 +48,8 @@ pub enum EntityType { impl From for NativeEntityType { fn from(value: EntityType) -> Self { match value { - EntityType::Resource => Self::Resource, + EntityType::FungibleResource => Self::FungibleResource, + EntityType::NonFungibleResource => Self::NonFungibleResource, EntityType::Package => Self::Package, EntityType::NormalComponent => Self::NormalComponent, EntityType::AccountComponent => Self::AccountComponent, @@ -75,7 +77,8 @@ impl From for NativeEntityType { impl From for EntityType { fn from(value: NativeEntityType) -> Self { match value { - NativeEntityType::Resource => Self::Resource, + NativeEntityType::FungibleResource => Self::FungibleResource, + NativeEntityType::NonFungibleResource => Self::NonFungibleResource, NativeEntityType::Package => Self::Package, NativeEntityType::NormalComponent => Self::NormalComponent, NativeEntityType::AccountComponent => Self::AccountComponent, diff --git a/radix-engine-toolkit/src/model/address/network_aware_address.rs b/radix-engine-toolkit/src/model/address/network_aware_address.rs index 8d0605c1..a6d7415f 100644 --- a/radix-engine-toolkit/src/model/address/network_aware_address.rs +++ b/radix-engine-toolkit/src/model/address/network_aware_address.rs @@ -18,8 +18,8 @@ use std::fmt::Display; use std::str::FromStr; -use crate::address::Bech32Coder; use crate::error::{Error, Result}; +use crate::model::address::Bech32Coder; // Defines a network aware address. This is needed for the serialization and deserialization using // serde. @@ -71,6 +71,26 @@ macro_rules! define_network_aware_address { }) } } + + /// An implementation of borrow which allows the network aware types to be borrowed as + /// non-network aware types. Useful for Bech32 encoding. + impl std::borrow::Borrow<$underlying_type> for $network_aware_struct_ident { + fn borrow(&self) -> &$underlying_type { + &self.address + } + } + + impl std::borrow::Borrow<$underlying_type> for &$network_aware_struct_ident { + fn borrow(&self) -> &$underlying_type { + &self.address + } + } + + impl std::borrow::Borrow<$underlying_type> for &mut $network_aware_struct_ident { + fn borrow(&self) -> &$underlying_type { + &self.address + } + } }; } diff --git a/radix-engine-toolkit/src/model/address/non_fungible_global_id.rs b/radix-engine-toolkit/src/model/address/non_fungible_global_id.rs index f3b89865..e996d4c9 100644 --- a/radix-engine-toolkit/src/model/address/non_fungible_global_id.rs +++ b/radix-engine-toolkit/src/model/address/non_fungible_global_id.rs @@ -15,25 +15,32 @@ // specific language governing permissions and limitations // under the License. +use crate::model::address::EntityAddress; use scrypto::prelude::{ FromPublicKey, NonFungibleGlobalId as NativeNonFungibleGlobalId, NonFungibleLocalId, PublicKey, }; -use serializable::serializable; +use toolkit_derive::serializable; -use crate::model::NetworkAwareResourceAddress; +use crate::model::address::NetworkAwareResourceAddress; /// Represents a non-fungible address which may be considered as the "global" address of a /// non-fungible unit as it contains both the resource address and the non-fungible id for that /// unit. #[serializable] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] +#[schemars( + example = "crate::example::address::non_fungible::non_fungible_global_integer", + example = "crate::example::address::non_fungible::non_fungible_global_string", + example = "crate::example::address::non_fungible::non_fungible_global_bytes", + example = "crate::example::address::non_fungible::non_fungible_global_uuid" +)] pub struct NonFungibleGlobalId { - #[schemars(with = "crate::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub resource_address: NetworkAwareResourceAddress, - #[serde_as(as = "serde_with::TryFromInto")] - #[schemars(with = "crate::Value")] + #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "crate::model::address::NonFungibleLocalId")] pub non_fungible_local_id: NonFungibleLocalId, } diff --git a/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs b/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs index 404ae03c..af37014b 100644 --- a/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs +++ b/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs @@ -20,9 +20,9 @@ use scrypto::prelude::{ NonFungibleLocalId as ScryptoNonFungibleLocalId, StringNonFungibleLocalId, UUIDNonFungibleLocalId, }; -use serializable::serializable; +use toolkit_derive::serializable; -use crate::{Error, Result}; +use crate::error::{Error, Result}; #[serializable] #[serde(tag = "type", content = "value")] @@ -30,6 +30,7 @@ use crate::{Error, Result}; /// non-fungible ids may be. pub enum NonFungibleLocalId { /// A 64 bit unsigned integer non-fungible id type which is serialized as a string + #[schemars(example = "crate::example::address::non_fungible::non_fungible_local_integer")] Integer( #[schemars(regex(pattern = "[0-9]+"))] #[schemars(with = "String")] @@ -39,6 +40,7 @@ pub enum NonFungibleLocalId { // TODO: Should this be serialized as a GUID? /// A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string + #[schemars(example = "crate::example::address::non_fungible::non_fungible_local_uuid")] UUID( #[schemars(regex(pattern = "[0-9]+"))] #[schemars(with = "String")] @@ -48,6 +50,7 @@ pub enum NonFungibleLocalId { /// An byte array non-fungible id type which is serialized as a hex string. This can be between /// 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded. + #[schemars(example = "crate::example::address::non_fungible::non_fungible_local_uuid")] Bytes( #[schemars(regex(pattern = "[0-9a-fA-F]+"))] #[schemars(with = "String")] @@ -57,6 +60,7 @@ pub enum NonFungibleLocalId { ), /// A string non-fungible id. This can be between 1 and 64 characters long. + #[schemars(example = "crate::example::address::non_fungible::non_fungible_local_string")] String(#[schemars(length(min = 1, max = 64))] String), } diff --git a/radix-engine-toolkit/src/model/constants.rs b/radix-engine-toolkit/src/model/constants.rs index 216f799d..9c480ee2 100644 --- a/radix-engine-toolkit/src/model/constants.rs +++ b/radix-engine-toolkit/src/model/constants.rs @@ -15,9 +15,6 @@ // specific language governing permissions and limitations // under the License. -/// A constant representing the length of Radix Engine Node Identifiers (`RENodeId`s) -pub const RADIX_ENGINE_NODE_IDENTIFIER_LENGTH: usize = 36; - /// A constant representing the length of hashes uses by the Radix Engine and Scrypto. This is /// defined as a constant to allow for easy changes if the hashing algorithm uses is changed. pub const RADIX_ENGINE_HASH_LENGTH: usize = 32; diff --git a/radix-engine-toolkit/src/model/crypto/public_key.rs b/radix-engine-toolkit/src/model/crypto/public_key.rs index d81328f3..e9b29c72 100644 --- a/radix-engine-toolkit/src/model/crypto/public_key.rs +++ b/radix-engine-toolkit/src/model/crypto/public_key.rs @@ -16,7 +16,7 @@ // under the License. use scrypto::prelude::{EcdsaSecp256k1PublicKey, EddsaEd25519PublicKey}; -use serializable::serializable; +use toolkit_derive::serializable; // ================= // Model Definition @@ -28,6 +28,7 @@ use serializable::serializable; pub enum PublicKey { /// A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string /// representing a public key from the ECDSA Secp256k1 elliptic curve. + #[schemars(example = "crate::example::crypto::public_key1")] EcdsaSecp256k1 { #[schemars(length(equal = 66))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] @@ -38,6 +39,7 @@ pub enum PublicKey { /// A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string /// representing a public key from the EDDSA Ed25519 edwards curve. + #[schemars(example = "crate::example::crypto::public_key2")] EddsaEd25519 { #[schemars(length(equal = 66))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] diff --git a/radix-engine-toolkit/src/model/crypto/signature.rs b/radix-engine-toolkit/src/model/crypto/signature.rs index 952b0a04..a45e77fd 100644 --- a/radix-engine-toolkit/src/model/crypto/signature.rs +++ b/radix-engine-toolkit/src/model/crypto/signature.rs @@ -15,8 +15,10 @@ // specific language governing permissions and limitations // under the License. -use scrypto::prelude::{EcdsaSecp256k1Signature, EddsaEd25519Signature}; -use serializable::serializable; +use native_transaction::{ + ecdsa_secp256k1::EcdsaSecp256k1Signature, eddsa_ed25519::EddsaEd25519Signature, +}; +use toolkit_derive::serializable; // ================= // Model Definition @@ -32,6 +34,7 @@ pub enum Signature { /// ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] /// where `v` is the recovery id and is a single byte and `r` and `s` are the signature results /// and are 32 bytes each. + #[schemars(example = "crate::example::crypto::signature1")] EcdsaSecp256k1 { #[schemars(length(equal = 130))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] @@ -42,6 +45,7 @@ pub enum Signature { /// A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string /// representing a signature from the EDDSA Ed25519 edwards curve. + #[schemars(example = "crate::example::crypto::signature2")] EddsaEd25519 { #[schemars(length(equal = 128))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] @@ -55,7 +59,7 @@ pub enum Signature { // Conversions // ============ -impl From for scrypto::prelude::Signature { +impl From for native_transaction::model::Signature { fn from(value: Signature) -> Self { match value { Signature::EcdsaSecp256k1 { signature } => Self::EcdsaSecp256k1(signature), @@ -64,13 +68,13 @@ impl From for scrypto::prelude::Signature { } } -impl From for Signature { - fn from(value: scrypto::prelude::Signature) -> Self { +impl From for Signature { + fn from(value: native_transaction::model::Signature) -> Self { match value { - scrypto::prelude::Signature::EcdsaSecp256k1(signature) => { + native_transaction::model::Signature::EcdsaSecp256k1(signature) => { Self::EcdsaSecp256k1 { signature } } - scrypto::prelude::Signature::EddsaEd25519(signature) => { + native_transaction::model::Signature::EddsaEd25519(signature) => { Self::EddsaEd25519 { signature } } } diff --git a/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs b/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs index 47109bd8..b10ca8be 100644 --- a/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs +++ b/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs @@ -15,8 +15,10 @@ // specific language governing permissions and limitations // under the License. -use scrypto::prelude::{EcdsaSecp256k1Signature, EddsaEd25519PublicKey, EddsaEd25519Signature}; -use serializable::serializable; +use native_transaction::ecdsa_secp256k1::EcdsaSecp256k1Signature; +use native_transaction::eddsa_ed25519::EddsaEd25519Signature; +use scrypto::prelude::EddsaEd25519PublicKey; +use toolkit_derive::serializable; // ================= // Model Definition @@ -28,6 +30,7 @@ use serializable::serializable; #[serde(tag = "curve")] pub enum SignatureWithPublicKey { /// Cryptographic signature and public key for Ecdsa Secp256k1 + #[schemars(example = "crate::example::crypto::signature_with_public_key1")] EcdsaSecp256k1 { /// A byte array of 65 bytes which are serialized as a 130 character long hex-encoded /// string representing a signature from the ECDSA Secp256k1 elliptic curve. An @@ -44,6 +47,7 @@ pub enum SignatureWithPublicKey { }, /// Cryptographic signature and public key for EdDSA Ed25519 + #[schemars(example = "crate::example::crypto::signature_with_public_key2")] EddsaEd25519 { /// A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string /// representing a public key from the EDDSA Ed25519 edwards curve. @@ -67,7 +71,7 @@ pub enum SignatureWithPublicKey { // Conversions // ============ -impl From for scrypto::prelude::SignatureWithPublicKey { +impl From for native_transaction::model::SignatureWithPublicKey { fn from(value: SignatureWithPublicKey) -> Self { match value { SignatureWithPublicKey::EcdsaSecp256k1 { signature } => { @@ -84,13 +88,13 @@ impl From for scrypto::prelude::SignatureWithPublicKey { } } -impl From for SignatureWithPublicKey { - fn from(value: scrypto::prelude::SignatureWithPublicKey) -> Self { +impl From for SignatureWithPublicKey { + fn from(value: native_transaction::model::SignatureWithPublicKey) -> Self { match value { - scrypto::prelude::SignatureWithPublicKey::EcdsaSecp256k1 { signature } => { + native_transaction::model::SignatureWithPublicKey::EcdsaSecp256k1 { signature } => { Self::EcdsaSecp256k1 { signature } } - scrypto::prelude::SignatureWithPublicKey::EddsaEd25519 { + native_transaction::model::SignatureWithPublicKey::EddsaEd25519 { signature, public_key, } => Self::EddsaEd25519 { diff --git a/radix-engine-toolkit/src/model/engine_identifier/node_identifier.rs b/radix-engine-toolkit/src/model/engine_identifier/node_identifier.rs index e8f52282..d34f9c1a 100644 --- a/radix-engine-toolkit/src/model/engine_identifier/node_identifier.rs +++ b/radix-engine-toolkit/src/model/engine_identifier/node_identifier.rs @@ -15,14 +15,14 @@ // specific language governing permissions and limitations // under the License. +use radix_engine_common::data::scrypto::model::OBJECT_ID_LENGTH; use std::fmt::Display; use std::str::FromStr; -use scrypto_utils::copy_u8_array; -use serializable::serializable; +use toolkit_derive::serializable; -use crate::constants::RADIX_ENGINE_NODE_IDENTIFIER_LENGTH; use crate::error::{Error, Result}; +use crate::utils::checked_copy_u8_slice; // ================= // Model Definition @@ -30,13 +30,14 @@ use crate::error::{Error, Result}; #[serializable] /// Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a -/// hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.) +/// hexadecimal string of length 31 (since hex encoding doubles the number of bytes needed.) +#[derive(PartialEq, PartialOrd, Eq, Ord, Hash)] pub struct NodeIdentifier( - #[schemars(length(equal = 72))] + #[schemars(length(equal = 31))] #[schemars(regex(pattern = "[0-9a-fA-F]+"))] #[schemars(with = "String")] #[serde_as(as = "serde_with::hex::Hex")] - pub [u8; RADIX_ENGINE_NODE_IDENTIFIER_LENGTH], + pub [u8; OBJECT_ID_LENGTH], ); // ===== @@ -57,13 +58,13 @@ impl FromStr for NodeIdentifier { let bytes = hex::decode(s)?; // Check that the decoded bytes are of the expected length - error out if they're not - if bytes.len() != RADIX_ENGINE_NODE_IDENTIFIER_LENGTH { + if bytes.len() != OBJECT_ID_LENGTH { Err(Error::InvalidLength { - expected: RADIX_ENGINE_NODE_IDENTIFIER_LENGTH, + expected: OBJECT_ID_LENGTH, found: bytes.len(), }) } else { - Ok(NodeIdentifier(copy_u8_array(&bytes))) + Ok(NodeIdentifier(checked_copy_u8_slice(&bytes)?)) } } } diff --git a/radix-engine-toolkit/src/model/engine_identifier/own.rs b/radix-engine-toolkit/src/model/engine_identifier/own.rs index c8f7173d..6a6d3a74 100644 --- a/radix-engine-toolkit/src/model/engine_identifier/own.rs +++ b/radix-engine-toolkit/src/model/engine_identifier/own.rs @@ -15,9 +15,9 @@ // specific language governing permissions and limitations // under the License. -use crate::NodeIdentifier; +use crate::model::engine_identifier::NodeIdentifier; use scrypto::runtime::Own as ScryptoOwn; -use serializable::serializable; +use toolkit_derive::serializable; // ================= // Model Definition @@ -31,36 +31,26 @@ pub enum Own { /// Represents an owned KeyValueStore KeyValueStore(NodeIdentifier), - /// Represents an owned Component - Component(NodeIdentifier), + /// Represents an owned Object + Object(NodeIdentifier), /// Represents an owned Vault Vault(NodeIdentifier), - /// Represents an owned Bucket identified through an unsigned 32-bit integer which is - /// serialized as a string - Bucket( - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - u32, - ), + /// Represents an owned Bucket + Bucket(NodeIdentifier), - /// Represents an owned Proof identified through an unsigned 32-bit integer which is serialized - /// as a string - Proof( - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - u32, - ), + /// Represents an owned Proof + Proof(NodeIdentifier), } impl From for Own { fn from(value: ScryptoOwn) -> Self { match value { - ScryptoOwn::Bucket(v) => Self::Bucket(v), - ScryptoOwn::Proof(v) => Self::Proof(v), + ScryptoOwn::Bucket(v) => Self::Bucket(NodeIdentifier(v)), + ScryptoOwn::Proof(v) => Self::Proof(NodeIdentifier(v)), ScryptoOwn::KeyValueStore(v) => Self::KeyValueStore(NodeIdentifier(v)), - ScryptoOwn::Component(v) => Self::Component(NodeIdentifier(v)), + ScryptoOwn::Object(v) => Self::Object(NodeIdentifier(v)), ScryptoOwn::Vault(v) => Self::Vault(NodeIdentifier(v)), } } @@ -69,11 +59,11 @@ impl From for Own { impl From for ScryptoOwn { fn from(value: Own) -> Self { match value { - Own::Bucket(v) => Self::Bucket(v), - Own::Proof(v) => Self::Proof(v), + Own::Bucket(v) => Self::Bucket(v.0), + Own::Proof(v) => Self::Proof(v.0), Own::KeyValueStore(v) => Self::KeyValueStore(v.0), - Own::Component(v) => Self::Component(v.0), Own::Vault(v) => Self::Vault(v.0), + Own::Object(v) => Self::Object(v.0), } } } diff --git a/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs b/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs index 09dd3f3a..73d83afd 100644 --- a/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs +++ b/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs @@ -15,11 +15,9 @@ // specific language governing permissions and limitations // under the License. -use crate::{Error, Result}; -use scrypto::prelude::ScryptoCustomValue; -use scrypto::runtime::{ManifestBucket, ManifestProof}; -use serializable::serializable; +use crate::error::{Error, Result}; use std::str::FromStr; +use toolkit_derive::serializable; // ================= // Model Definition @@ -32,10 +30,13 @@ use std::str::FromStr; /// and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a /// number and not a string) pub enum TransientIdentifier { + #[schemars(example = "crate::example::engine_identifier::transient_identifier::string")] String { /// A string identifier value: String, }, + + #[schemars(example = "crate::example::engine_identifier::transient_identifier::u32")] U32 { /// A 32-bit unsigned integer which is serialized and deserialized as a string. #[schemars(regex(pattern = "[0-9]+"))] @@ -47,11 +48,19 @@ pub enum TransientIdentifier { #[serializable] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] +#[schemars( + example = "crate::example::engine_identifier::transient_identifier::bucket_id1", + example = "crate::example::engine_identifier::transient_identifier::bucket_id2" +)] /// Represents a BucketId which uses a transient identifier. pub struct BucketId(pub TransientIdentifier); #[serializable] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] +#[schemars( + example = "crate::example::engine_identifier::transient_identifier::proof_id1", + example = "crate::example::engine_identifier::transient_identifier::proof_id2" +)] /// Represents a ProofId which uses a transient identifier. pub struct ProofId(pub TransientIdentifier); @@ -104,63 +113,3 @@ impl From for TransientIdentifier { proof_id.0 } } - -impl TryFrom for ScryptoCustomValue { - type Error = Error; - - fn try_from(value: BucketId) -> std::result::Result { - match value.0 { - TransientIdentifier::U32 { value: identifier } => { - Ok(ScryptoCustomValue::Bucket(ManifestBucket(identifier))) - } - TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { - value_kind: crate::ValueKind::Bucket, - }), - } - } -} - -impl TryFrom<&BucketId> for ScryptoCustomValue { - type Error = Error; - - fn try_from(value: &BucketId) -> std::result::Result { - match &value.0 { - TransientIdentifier::U32 { value: identifier } => { - Ok(ScryptoCustomValue::Bucket(ManifestBucket(*identifier))) - } - TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { - value_kind: crate::ValueKind::Bucket, - }), - } - } -} - -impl TryFrom for ScryptoCustomValue { - type Error = Error; - - fn try_from(value: ProofId) -> std::result::Result { - match value.0 { - TransientIdentifier::U32 { value: identifier } => { - Ok(ScryptoCustomValue::Proof(ManifestProof(identifier))) - } - TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { - value_kind: crate::ValueKind::Proof, - }), - } - } -} - -impl TryFrom<&ProofId> for ScryptoCustomValue { - type Error = Error; - - fn try_from(value: &ProofId) -> std::result::Result { - match &value.0 { - TransientIdentifier::U32 { value: identifier } => { - Ok(ScryptoCustomValue::Proof(ManifestProof(*identifier))) - } - TransientIdentifier::String { .. } => Err(Error::BucketOrProofSBORError { - value_kind: crate::ValueKind::Proof, - }), - } - } -} diff --git a/radix-engine-toolkit/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs index cabbdc47..08f13292 100644 --- a/radix-engine-toolkit/src/model/instruction.rs +++ b/radix-engine-toolkit/src/model/instruction.rs @@ -17,13 +17,13 @@ use std::collections::BTreeSet; -use crate::address::Bech32Coder; use crate::error::Result; -use crate::Value; +use crate::model::address::Bech32Coder; +use crate::model::value::ast::ManifestAstValue; use native_transaction::manifest::ast; -use serializable::serializable; +use toolkit_derive::serializable; // NOTE: The model below should ALWAYS be kept up to date with that present in the Scrypto repo. // this model was authored for commit: e497a8b8c19fea8266337c5b3e5ada2e723153fc. When you @@ -43,516 +43,595 @@ use serializable::serializable; pub enum Instruction { /// An instruction to call a function with the given list of arguments on the given package /// address and blueprint name. + #[schemars( + example = "crate::example::instruction::call_function1", + example = "crate::example::instruction::call_function2", + example = "crate::example::instruction::call_function3", + example = "crate::example::instruction::call_function4" + )] CallFunction { /// The address of the package containing the blueprint that contains the desired function. - /// This package address is serialized as the `PackageAddress` variant of the `Value` - /// model. - package_address: Value, + /// This package address is serialized as the `PackageAddress` variant of the + /// `ManifestAstValue` model. + package_address: ManifestAstValue, /// A string of the name of the blueprint containing the desired function. This field is - /// serialized as a `String` from the Value model. - blueprint_name: Value, + /// serialized as a `String` from the ManifestAstValue model. + blueprint_name: ManifestAstValue, /// A string of the name of the function to call. This field is serialized as a `String` - /// from the Value model. - function_name: Value, + /// from the ManifestAstValue model. + function_name: ManifestAstValue, - /// An optional array of `Value` arguments to call the function with. If this array is - /// empty or is not provided, then the function is called with no arguments. - arguments: Option>, + /// An optional array of `ManifestAstValue` arguments to call the function with. If this + /// array is empty or is not provided, then the function is called with no + /// arguments. + arguments: Option>, }, /// An instruction to call a method with a given name on a given component address with the /// given list of arguments. + #[schemars( + example = "crate::example::instruction::call_method1", + example = "crate::example::instruction::call_method2", + example = "crate::example::instruction::call_method3", + example = "crate::example::instruction::call_method4" + )] CallMethod { /// The address of the component which contains the method to be invoked. This field is - /// serialized as a `ComponentAddress` from the Value model. - component_address: Value, + /// serialized as a `ComponentAddress` from the ManifestAstValue model. + component_address: ManifestAstValue, /// A string of the name of the method to call. his field is serialized as a `String` from - /// the Value model. - method_name: Value, + /// the ManifestAstValue model. + method_name: ManifestAstValue, - /// An optional array of `Value` arguments to call the method with. If this array is empty - /// or is not provided, then the method is called with no arguments. - arguments: Option>, + /// An optional array of `ManifestAstValue` arguments to call the method with. If this + /// array is empty or is not provided, then the method is called with no arguments. + arguments: Option>, }, /// An instruction to take the entire amount of a given resource address from the worktop and /// put it in a bucket. + #[schemars( + example = "crate::example::instruction::take_from_worktop1", + example = "crate::example::instruction::take_from_worktop2" + )] TakeFromWorktop { /// The address of the resource to take from the worktop. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from - /// the Value model. - into_bucket: Value, + /// the ManifestAstValue model. + into_bucket: ManifestAstValue, }, /// An instruction to take the an amount of a given resource address from the worktop and put /// it in a bucket. + #[schemars( + example = "crate::example::instruction::take_from_worktop_by_amount1", + example = "crate::example::instruction::take_from_worktop_by_amount2" + )] TakeFromWorktopByAmount { /// The address of the resource to take from the worktop. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// The amount of the resource to take from the worktop. This field is serialized as a - /// `Decimal` from the Value model. - amount: Value, + /// `Decimal` from the ManifestAstValue model. + amount: ManifestAstValue, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from - /// the Value model. - into_bucket: Value, + /// the ManifestAstValue model. + into_bucket: ManifestAstValue, }, /// An instruction to take the a set of non-fungible ids of a given resource address from the /// worktop and put it in a bucket. + #[schemars( + example = "crate::example::instruction::take_from_worktop_by_ids1", + example = "crate::example::instruction::take_from_worktop_by_ids2" + )] TakeFromWorktopByIds { /// The address of the resource to take from the worktop. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// The non-fungible ids to take from the worktop. This is a set (serialized as a JSON - /// array) of `NonFungibleLocalId`s from the Value model. + /// array) of `NonFungibleLocalId`s from the ManifestAstValue model. #[schemars(with = "BTreeSet")] - ids: Vec, + ids: Vec, /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from - /// the Value model. - into_bucket: Value, + /// the ManifestAstValue model. + into_bucket: ManifestAstValue, }, /// Returns a bucket of tokens to the worktop. + #[schemars(example = "crate::example::instruction::return_to_worktop")] ReturnToWorktop { /// The bucket to return to the worktop. - bucket: Value, + bucket: ManifestAstValue, }, /// An instruction to assert that a given resource exists in the worktop. + #[schemars( + example = "crate::example::instruction::assert_worktop_contains1", + example = "crate::example::instruction::assert_worktop_contains2" + )] AssertWorktopContains { /// The address of the resource to perform the assertion on. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, }, /// An instruction to assert that a specific amount of a specific resource address exists in /// the worktop. + #[schemars( + example = "crate::example::instruction::assert_worktop_contains_by_amount1", + example = "crate::example::instruction::assert_worktop_contains_by_amount2" + )] AssertWorktopContainsByAmount { /// The address of the resource to perform the assertion on. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// The amount of the resource to assert their existence in the worktop. This field is - /// serialized as a `Decimal` from the Value model. - amount: Value, + /// serialized as a `Decimal` from the ManifestAstValue model. + amount: ManifestAstValue, }, /// An instruction to assert that a set ids of a specific resource address exists in the /// worktop. + #[schemars( + example = "crate::example::instruction::assert_worktop_contains_by_ids1", + example = "crate::example::instruction::assert_worktop_contains_by_ids2" + )] AssertWorktopContainsByIds { /// The address of the resource to perform the assertion on. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// The non-fungible ids of the resource to assert their existence in the worktop. This is - /// a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model. + /// a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue + /// model. #[schemars(with = "BTreeSet")] - ids: Vec, + ids: Vec, }, /// An instruction which pops a proof from the AuthZone stack and into an identifiable proof + #[schemars(example = "crate::example::instruction::pop_from_auth_zone")] PopFromAuthZone { - /// The proof to put the popped proof into. This is serialized as a `Proof` from the Value - /// model. - into_proof: Value, + /// The proof to put the popped proof into. This is serialized as a `Proof` from the + /// ManifestAstValue model. + into_proof: ManifestAstValue, }, /// An instruction that pushes a proof to the auth zone stack. + #[schemars(example = "crate::example::instruction::push_to_auth_zone")] PushToAuthZone { /// The proof to push to the auth zone stack. This is serialized as a `Proof` from the - /// Value model. - proof: Value, + /// ManifestAstValue model. + proof: ManifestAstValue, }, /// An instruction which clears the auth zone stack by dropping all of the proofs in that /// stack. + #[schemars(example = "crate::example::instruction::clear_auth_zone")] ClearAuthZone, + /// Clears all the proofs of signature virtual badges. + #[schemars(example = "crate::example::instruction::clear_signature_proofs")] + ClearSignatureProofs, + /// An instruction to create a proof of the entire amount of a given resource address from the /// auth zone. + #[schemars( + example = "crate::example::instruction::create_proof_from_auth_zone1", + example = "crate::example::instruction::create_proof_from_auth_zone2" + )] CreateProofFromAuthZone { /// The address of the resource to create a proof of. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the - /// Value model. - into_proof: Value, + /// ManifestAstValue model. + into_proof: ManifestAstValue, }, /// An instruction to create a proof of the an amount of a given resource address from the auth /// zone. + #[schemars( + example = "crate::example::instruction::create_proof_from_auth_zone_by_amount1", + example = "crate::example::instruction::create_proof_from_auth_zone_by_amount2" + )] CreateProofFromAuthZoneByAmount { /// The address of the resource to create a proof of. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// The amount of the resource to create a proof of. This field is serialized as a - /// `Decimal` from the Value model. - amount: Value, + /// `Decimal` from the ManifestAstValue model. + amount: ManifestAstValue, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the - /// Value model. - into_proof: Value, + /// ManifestAstValue model. + into_proof: ManifestAstValue, }, /// An instruction to create a proof of the a set of non-fungible ids of a given resource /// address from the auth zone. + #[schemars( + example = "crate::example::instruction::create_proof_from_auth_zone_by_ids1", + example = "crate::example::instruction::create_proof_from_auth_zone_by_ids2" + )] CreateProofFromAuthZoneByIds { /// The address of the resource to create a proof of. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) - /// of `NonFungibleLocalId`s from the Value model. + /// of `NonFungibleLocalId`s from the ManifestAstValue model. #[schemars(with = "BTreeSet")] - ids: Vec, + ids: Vec, /// A proof to put the resource proof into. This field is serialized as a `Proof` from the - /// Value model. - into_proof: Value, + /// ManifestAstValue model. + into_proof: ManifestAstValue, }, /// An instruction to create a proof given a bucket of some resources + #[schemars(example = "crate::example::instruction::create_proof_from_bucket")] CreateProofFromBucket { /// The bucket of resources to create a proof from. This field is serialized as a `Bucket` - /// from the Value model. - bucket: Value, + /// from the ManifestAstValue model. + bucket: ManifestAstValue, /// The proof variable that the proof should go to. This field is serialized as a `Proof` - /// from the Value model. - into_proof: Value, + /// from the ManifestAstValue model. + into_proof: ManifestAstValue, }, /// An instruction to clone a proof creating a second proof identical to the original + #[schemars(example = "crate::example::instruction::clone_proof")] CloneProof { /// The original proof, or the proof to be cloned. This field is serialized as a `Proof` - /// from the Value model. - proof: Value, + /// from the ManifestAstValue model. + proof: ManifestAstValue, /// The proof variable that the proof should go to. This field is serialized as a `Proof` - /// from the Value model. - into_proof: Value, + /// from the ManifestAstValue model. + into_proof: ManifestAstValue, }, /// An instruction to drop a proof. + #[schemars(example = "crate::example::instruction::drop_proof")] DropProof { - /// The proof to drop. This field is serialized as a `Proof` from the Value model. - proof: Value, + /// The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue + /// model. + proof: ManifestAstValue, }, /// An instruction to drop all proofs currently present in the transaction context. + #[schemars(example = "crate::example::instruction::drop_all_proofs")] DropAllProofs, /// An instruction to publish a package and set it's associated royalty configs, metadata, /// and access rules. + #[schemars(example = "crate::example::instruction::publish_package")] PublishPackage { - /// The blob of the package code. This field is serialized as a `Blob` from the Value - /// model. - code: Value, + /// The blob of the package code. This field is serialized as a `Blob` from the + /// ManifestAstValue model. + code: ManifestAstValue, - /// The blob of the package ABI. This field is serialized as a `Blob` from the Value model. - abi: Value, + /// The blob of the package ABI. This field is serialized as a `Blob` from the + /// ManifestAstValue model. + schema: ManifestAstValue, /// The configurations of the royalty for the package. The underlying type of this is a Map /// where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. - /// This is serialized as an `Map` from the Value model. - royalty_config: Value, + /// This is serialized as an `Map` from the ManifestAstValue model. + royalty_config: ManifestAstValue, /// The metadata to use for the package. The underlying type of this is a string-string Map - /// of the metadata. This is serialized as an `Map` from the Value model. - metadata: Value, - - /// The access rules to use for the package. This is serialized as a `Tuple` from the Value - /// model. - access_rules: Value, - }, - - /// An instruction to publish a package with an associated "owner" badge where all of the - /// authority on the package is in the hands of said owner. - PublishPackageWithOwner { - /// The blob of the package code. This field is serialized as a `Blob` from the Value - /// model. - code: Value, - - /// The blob of the package ABI. This field is serialized as a `Blob` from the Value model. - abi: Value, + /// of the metadata. This is serialized as an `Map` from the ManifestAstValue model. + metadata: ManifestAstValue, - /// The non-fungible address of the owner badge of this package. This field is serialized - /// as a `NonFungibleGlobalId` from the Value model. - owner_badge: Value, + /// The access rules to use for the package. This is serialized as a `Tuple` from the + /// ManifestAstValue model. + access_rules: ManifestAstValue, }, /// An instruction to burn a bucket of tokens. + #[schemars(example = "crate::example::instruction::burn_resource")] BurnResource { /// The bucket of tokens to burn. - bucket: Value, + bucket: ManifestAstValue, }, /// An instruction ot recall resources from a known vault. + #[schemars(example = "crate::example::instruction::recall_resource")] RecallResource { /// The id of the vault of the tokens to recall. This field is serialized as an `Own` from /// the value model and is expected to be an `Own::Vault`. - vault_id: Value, + vault_id: ManifestAstValue, /// The amount of tokens to recall from the vault. This field is serialized as a `Decimal` - /// field from the Value model. - amount: Value, + /// field from the ManifestAstValue model. + amount: ManifestAstValue, }, /// An instruction to set the metadata on an entity. + #[schemars(example = "crate::example::instruction::set_metadata")] SetMetadata { /// The address of the entity to set metadata on. This is a discriminated union of types /// where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or /// a `ComponentAddress`. - entity_address: Value, + entity_address: ManifestAstValue, /// A string of the key to set the metadata for. This field is serialized as a `String` - /// from the Value model. - key: Value, + /// from the ManifestAstValue model. + key: ManifestAstValue, /// A string of the value to set the metadata for. This field is serialized as a `String` - /// from the Value model. - value: Value, + /// from the ManifestAstValue model. + value: ManifestAstValue, + }, + + /// An instruction to set the metadata on an entity. + #[schemars(example = "crate::example::instruction::remove_metadata")] + RemoveMetadata { + /// The address of the entity to set metadata on. This is a discriminated union of types + /// where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or + /// a `ComponentAddress`. + entity_address: ManifestAstValue, + + /// A string of the key to remove the metadata for. This field is serialized as a `String` + /// from the ManifestAstValue model. + key: ManifestAstValue, }, /// An instruction to modify the royalties of a package. + #[schemars(example = "crate::example::instruction::set_package_royalty_config")] SetPackageRoyaltyConfig { /// The address of the package to set the royalty on. This is serialized as a - /// `PackageAddress` from the Value model. - package_address: Value, + /// `PackageAddress` from the ManifestAstValue model. + package_address: ManifestAstValue, /// The configurations of the royalty for the package. The underlying type of this is a Map /// where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. - /// This is serialized as an `Map` from the Value model. - royalty_config: Value, + /// This is serialized as an `Map` from the ManifestAstValue model. + royalty_config: ManifestAstValue, }, /// An instruction to modify the royalties on a component + #[schemars(example = "crate::example::instruction::set_component_royalty_config")] SetComponentRoyaltyConfig { /// The component address of the component to modify royalties for. This field is - /// serialized as a `ComponentAddress` from the Value model. - component_address: Value, + /// serialized as a `ComponentAddress` from the ManifestAstValue model. + component_address: ManifestAstValue, - /// The royalty config to set on the component. This is an `Enum` from the `Value` model. - royalty_config: Value, + /// The royalty config to set on the component. This is an `Enum` from the + /// `ManifestAstValue` model. + royalty_config: ManifestAstValue, }, /// An instruction to claim royalties of a package + #[schemars(example = "crate::example::instruction::claim_package_royalty")] ClaimPackageRoyalty { /// The package address of the package to claim royalties for. This field is serialized as - /// a `PackageAddress` from the Value model. - package_address: Value, + /// a `PackageAddress` from the ManifestAstValue model. + package_address: ManifestAstValue, }, /// An instruction to claim royalties of a component + #[schemars(example = "crate::example::instruction::claim_component_royalty")] ClaimComponentRoyalty { /// The component address of the component to claim royalties for. This field is serialized - /// as a `ComponentAddress` from the Value model. - component_address: Value, + /// as a `ComponentAddress` from the ManifestAstValue model. + component_address: ManifestAstValue, }, /// An instruction to modify the access rules of a method that an entity has. + #[schemars(example = "crate::example::instruction::set_method_access_rule")] SetMethodAccessRule { /// The entity address of the entity to modify the access rules for. - entity_address: Value, - - /// Entity access rules is a stack of access rules, this index allows referring to a - /// specific "layer" in said stack. This field is serialized as a `U32` from the `Value` - /// model. - index: Value, + entity_address: ManifestAstValue, /// The method key for the method to set the access rule of. This field is serialized as an - /// `Enum` from the Value model - key: Value, + /// `Enum` from the ManifestAstValue model + key: ManifestAstValue, /// The new access rule to set in-place of the old one. This field is serialized as an - /// `Enum` from the Value model - rule: Value, + /// `Enum` from the ManifestAstValue model + rule: ManifestAstValue, }, /// An instruction to mint fungible resources + #[schemars(example = "crate::example::instruction::mint_fungible")] MintFungible { /// The address of the resource to mint tokens of. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// The amount of fungible tokens to mint of this resource. This field is serialized as a - /// `Decimal` from the Value model. - amount: Value, + /// `Decimal` from the ManifestAstValue model. + amount: ManifestAstValue, }, /// An instruction to mint non-fungibles of a resource + #[schemars(example = "crate::example::instruction::mint_non_fungible")] MintNonFungible { /// The address of the resource to mint tokens of. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// The non-fungible tokens to mint. The underlying type of this is a map which maps a - /// `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct - /// of the immutable and mutable parts of the non-fungible data. - entries: Value, + /// `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element + /// is a struct of the immutable and mutable parts of the non-fungible data. + entries: ManifestAstValue, }, /// An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type /// id and perform auto incrimination of ID. + #[schemars(example = "crate::example::instruction::mint_uuid_non_fungible")] MintUuidNonFungible { /// The address of the resource to mint tokens of. This field is serialized as a - /// `ResourceAddress` from the Value model. - resource_address: Value, + /// `ResourceAddress` from the ManifestAstValue model. + resource_address: ManifestAstValue, /// The non-fungible tokens to mint. The underlying type is a vector of tuples of two - /// `Value` elements where each element is a struct of the immutable and mutable + /// `ManifestAstValue` elements where each element is a struct of the immutable and mutable /// parts of the non-fungible data. - entries: Value, + entries: ManifestAstValue, }, /// An instruction to create a new fungible resource. + #[schemars(example = "crate::example::instruction::create_fungible_resource")] CreateFungibleResource { - /// The divisibility of the resource. This field is serialized as a `U8` from the Value - /// model. - divisibility: Value, + /// The divisibility of the resource. This field is serialized as a `U8` from the + /// ManifestAstValue model. + divisibility: ManifestAstValue, /// The metadata to set on the resource. The underlying type of this is a string-string Map - /// of the metadata. This is serialized as an `Map` from the Value model. - metadata: Value, + /// of the metadata. This is serialized as an `Map` from the ManifestAstValue model. + metadata: ManifestAstValue, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the /// current behavior and the mutability. This is serialized as an `Map` from the - /// Value model. - access_rules: Value, - - /// An optional decimal value of the initial supply to mint during resource creation. If - /// present, this is serialized as a `Decimal` from the value model. - initial_supply: Value, + /// ManifestAstValue model. + access_rules: ManifestAstValue, }, - /// An instruction to create a fungible resource with an associated "owner" badge where all of - /// the authority on the resource is in the hands of said owner. - CreateFungibleResourceWithOwner { - /// The divisibility of the resource. This field is serialized as a `U8` from the Value - /// model. - divisibility: Value, + /// An instruction to create a fungible resource with initial supply + #[schemars( + example = "crate::example::instruction::create_fungible_resource_with_initial_supply" + )] + CreateFungibleResourceWithInitialSupply { + /// The divisibility of the resource. This field is serialized as a `U8` from the + /// ManifestAstValue model. + divisibility: ManifestAstValue, /// The metadata to set on the resource. The underlying type of this is a string-string Map - /// of the metadata. This is serialized as an `Map` from the Value model. - metadata: Value, + /// of the metadata. This is serialized as an `Map` from the ManifestAstValue model. + metadata: ManifestAstValue, - /// The non-fungible address of the owner badge of this resource. This field is serialized - /// as a `NonFungibleGlobalId` from the Value model. - owner_badge: Value, + /// The access rules to use for the resource. The underlying type of this is a map which + /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the + /// current behavior and the mutability. This is serialized as an `Map` from the + /// ManifestAstValue model. + access_rules: ManifestAstValue, - /// An optional decimal value of the initial supply to mint during resource creation. If - /// present, this is serialized as a `Decimal` from the value model. - initial_supply: Value, + /// A decimal value of the initial supply to mint during resource creation. If present, + /// this is serialized as a `Decimal` from the value model. + initial_supply: ManifestAstValue, }, /// An instruction to create a new non-fungible resource. + #[schemars(example = "crate::example::instruction::create_non_fungible_resource")] CreateNonFungibleResource { /// The type of the non-fungible id to use for this resource. This field is serialized as - /// an `Enum` from the Value model. - id_type: Value, + /// an `Enum` from the ManifestAstValue model. + id_type: ManifestAstValue, + + /// The schema that all non-fungibles of this resource must adhere to. + schema: ManifestAstValue, /// The metadata to set on the resource. The underlying type of this is a string-string Map - /// of the metadata. This is serialized as an `Map` from the Value model. - metadata: Value, + /// of the metadata. This is serialized as an `Map` from the ManifestAstValue model. + metadata: ManifestAstValue, /// The access rules to use for the resource. The underlying type of this is a map which /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the /// current behavior and the mutability. This is serialized as an `Map` from the - /// Value model. - access_rules: Value, - - /// An optional initial supply for the non-fungible resource being created. The underlying - /// type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` - /// elements where each element is a struct of the immutable and mutable parts of - /// the non-fungible data. - initial_supply: Value, + /// ManifestAstValue model. + access_rules: ManifestAstValue, }, - /// An instruction to create a non-fungible resource with an associated "owner" badge where all - /// of the authority on the resource is in the hands of said owner. - CreateNonFungibleResourceWithOwner { + /// An instruction to create a non-fungible resource with an initial supply + // #[schemars( + // example = + // "crate::example::instruction::create_non_fungible_resource_with_initial_supply" )] + CreateNonFungibleResourceWithInitialSupply { /// The type of the non-fungible id to use for this resource. This field is serialized as - /// an `Enum` from the Value model. - id_type: Value, + /// an `Enum` from the ManifestAstValue model. + id_type: ManifestAstValue, + + /// The schema that all non-fungibles of this resource must adhere to. + schema: ManifestAstValue, /// The metadata to set on the resource. The underlying type of this is a string-string Map - /// of the metadata. This is serialized as an `Map` from the Value model. - metadata: Value, + /// of the metadata. This is serialized as an `Map` from the ManifestAstValue model. + metadata: ManifestAstValue, - /// The non-fungible address of the owner badge of this resource. This field is serialized - /// as a `NonFungibleGlobalId` from the Value model. - owner_badge: Value, + /// The access rules to use for the resource. The underlying type of this is a map which + /// maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the + /// current behavior and the mutability. This is serialized as an `Map` from the + /// ManifestAstValue model. + access_rules: ManifestAstValue, /// An optional initial supply for the non-fungible resource being created. The underlying - /// type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` - /// elements where each element is a struct of the immutable and mutable parts of - /// the non-fungible data. - initial_supply: Value, + /// type of this is a map which maps a `NonFungibleLocalId` to a tuple of two + /// `ManifestAstValue` elements where each element is a struct of the immutable and + /// mutable parts of the non-fungible data. + initial_supply: ManifestAstValue, }, /// Creates a new access controller native component with the passed set of rules as the /// current active rule set and the specified timed recovery delay in minutes. + #[schemars(example = "crate::example::instruction::create_access_controller")] CreateAccessController { /// A bucket of the asset that will be controlled by the access controller. The underlying - /// type of this is a `Bucket` from the `Value` model. - controlled_asset: Value, - - /// The access rule to use for the primary role of the access controller. The underlying - /// type of this is an `Enum` from the `Value` model. - primary_role: Value, + /// type of this is a `Bucket` from the `ManifestAstValue` model. + controlled_asset: ManifestAstValue, - /// The access rule to use for the recovery role of the access controller. The underlying - /// type of this is an `Enum` from the `Value` model. - recovery_role: Value, - - /// The access rule to use for the confirmation role of the access controller. The - /// underlying type of this is an `Enum` from the `Value` model. - confirmation_role: Value, + /// The set of rules to use for the access controller's primary, confirmation, and recovery + /// roles. + rule_set: ManifestAstValue, /// The recovery delay in minutes to use for the access controller. The underlying type of - /// this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer - /// of the time in minutes. - timed_recovery_delay_in_minutes: Value, + /// this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned + /// 32-bit integer of the time in minutes. + timed_recovery_delay_in_minutes: ManifestAstValue, }, /// Creates a new identity native component with the passed access rule. + #[schemars(example = "crate::example::instruction::create_identity")] CreateIdentity { /// The access rule to protect the identity with. The underlying type of this is an `Enum` - /// from the `Value` model. - access_rule: Value, + /// from the `ManifestAstValue` model. + access_rule: ManifestAstValue, }, /// Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of /// the transaction + #[schemars(example = "crate::example::instruction::assert_access_rule")] AssertAccessRule { - /// The access rule to assert. The underlying type of this is an `Enum` from the `Value` - /// model which represents the access rule to assert. - access_rule: Value, + /// The access rule to assert. The underlying type of this is an `Enum` from the + /// `ManifestAstValue` model which represents the access rule to assert. + access_rule: ManifestAstValue, }, /// Creates a validator given the public key of the owner who controls it + #[schemars(example = "crate::example::instruction::create_validator")] CreateValidator { /// The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of - /// this is an `EcdsaSecp256k1PublicKey` from the `Value` model. - key: Value, + /// this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model. + key: ManifestAstValue, /// The access rule to protect the validator with. The underlying type of this is an `Enum` - /// from the `Value` model which represents the access rule to assert. - owner_access_rule: Value, + /// from the `ManifestAstValue` model which represents the access rule to assert. + owner_access_rule: ManifestAstValue, + }, + + /// Creates a new global account component which has the withdraw rule seen in the rule. + #[schemars(example = "crate::example::instruction::create_account")] + CreateAccount { + /// The withdraw rule to associate with the account. + withdraw_rule: ManifestAstValue, }, } @@ -562,7 +641,7 @@ pub enum Instruction { impl Instruction { pub fn to_ast_instruction(&self, bech32_coder: &Bech32Coder) -> Result { - let ast_instruction = match self.clone() { + let ast_instruction = match self { Self::CallFunction { package_address, blueprint_name, @@ -573,6 +652,7 @@ impl Instruction { blueprint_name: blueprint_name.to_ast_value(bech32_coder)?, function_name: function_name.to_ast_value(bech32_coder)?, args: arguments + .clone() .unwrap_or_default() .iter() .map(|value| value.to_ast_value(bech32_coder)) @@ -586,6 +666,7 @@ impl Instruction { component_address: component_address.to_ast_value(bech32_coder)?, method_name: method_name.to_ast_value(bech32_coder)?, args: arguments + .clone() .unwrap_or_default() .iter() .map(|value| value.to_ast_value(bech32_coder)) @@ -612,9 +693,10 @@ impl Instruction { resource_address, into_bucket, } => ast::Instruction::TakeFromWorktopByIds { - ids: Value::Array { - element_kind: crate::model::value::ValueKind::NonFungibleLocalId, - elements: ids.into_iter().collect::>(), + ids: ManifestAstValue::Array { + element_kind: + crate::model::value::ast::ManifestAstValueKind::NonFungibleLocalId, + elements: ids.clone().into_iter().collect::>(), } .to_ast_value(bech32_coder)?, resource_address: resource_address.to_ast_value(bech32_coder)?, @@ -640,11 +722,12 @@ impl Instruction { ids, resource_address, } => ast::Instruction::AssertWorktopContainsByIds { - ids: Value::Array { - // TODO: This was `ValueKind::Bucket` by mistake. What kind of test can we - // introduce to catch this? - element_kind: crate::model::value::ValueKind::NonFungibleLocalId, - elements: ids.into_iter().collect::>(), + ids: ManifestAstValue::Array { + // TODO: This was `ManifestAstValueKind::Bucket` by mistake. What kind of test + // can we introduce to catch this? + element_kind: + crate::model::value::ast::ManifestAstValueKind::NonFungibleLocalId, + elements: ids.clone().into_iter().collect::>(), } .to_ast_value(bech32_coder)?, resource_address: resource_address.to_ast_value(bech32_coder)?, @@ -679,9 +762,10 @@ impl Instruction { resource_address, into_proof, } => ast::Instruction::CreateProofFromAuthZoneByIds { - ids: Value::Array { - element_kind: crate::model::value::ValueKind::NonFungibleLocalId, - elements: ids.into_iter().collect::>(), + ids: ManifestAstValue::Array { + element_kind: + crate::model::value::ast::ManifestAstValueKind::NonFungibleLocalId, + elements: ids.clone().into_iter().collect::>(), } .to_ast_value(bech32_coder)?, resource_address: resource_address.to_ast_value(bech32_coder)?, @@ -703,27 +787,19 @@ impl Instruction { proof: proof.to_ast_value(bech32_coder)?, }, Self::DropAllProofs => ast::Instruction::DropAllProofs, - Self::PublishPackageWithOwner { - code, - abi, - owner_badge, - } => ast::Instruction::PublishPackageWithOwner { - owner_badge: owner_badge.to_ast_value(bech32_coder)?, - code: code.to_ast_value(bech32_coder)?, - abi: abi.to_ast_value(bech32_coder)?, - }, + Self::ClearSignatureProofs => ast::Instruction::ClearSignatureProofs, Self::BurnResource { bucket } => ast::Instruction::BurnResource { bucket: bucket.to_ast_value(bech32_coder)?, }, Self::PublishPackage { code, - abi, + schema, royalty_config, metadata, access_rules, } => ast::Instruction::PublishPackage { code: code.to_ast_value(bech32_coder)?, - abi: abi.to_ast_value(bech32_coder)?, + schema: schema.to_ast_value(bech32_coder)?, royalty_config: royalty_config.to_ast_value(bech32_coder)?, metadata: metadata.to_ast_value(bech32_coder)?, access_rules: access_rules.to_ast_value(bech32_coder)?, @@ -744,6 +820,14 @@ impl Instruction { value: value.to_ast_value(bech32_coder)?, }, + Self::RemoveMetadata { + entity_address, + key, + } => ast::Instruction::RemoveMetadata { + entity_address: entity_address.to_ast_value(bech32_coder)?, + key: key.to_ast_value(bech32_coder)?, + }, + Self::SetPackageRoyaltyConfig { package_address, royalty_config, @@ -774,12 +858,10 @@ impl Instruction { Self::SetMethodAccessRule { entity_address, - index, key, rule, } => ast::Instruction::SetMethodAccessRule { entity_address: entity_address.to_ast_value(bech32_coder)?, - index: index.to_ast_value(bech32_coder)?, key: key.to_ast_value(bech32_coder)?, rule: rule.to_ast_value(bech32_coder)?, }, @@ -788,44 +870,44 @@ impl Instruction { divisibility, metadata, access_rules, - initial_supply, } => ast::Instruction::CreateFungibleResource { divisibility: divisibility.to_ast_value(bech32_coder)?, metadata: metadata.to_ast_value(bech32_coder)?, access_rules: access_rules.to_ast_value(bech32_coder)?, - initial_supply: initial_supply.to_ast_value(bech32_coder)?, }, - Self::CreateFungibleResourceWithOwner { + Self::CreateFungibleResourceWithInitialSupply { divisibility, metadata, - owner_badge, + access_rules, initial_supply, - } => ast::Instruction::CreateFungibleResourceWithOwner { + } => ast::Instruction::CreateFungibleResourceWithInitialSupply { divisibility: divisibility.to_ast_value(bech32_coder)?, metadata: metadata.to_ast_value(bech32_coder)?, - owner_badge: owner_badge.to_ast_value(bech32_coder)?, + access_rules: access_rules.to_ast_value(bech32_coder)?, initial_supply: initial_supply.to_ast_value(bech32_coder)?, }, Self::CreateNonFungibleResource { id_type, + schema, metadata, access_rules, - initial_supply, } => ast::Instruction::CreateNonFungibleResource { id_type: id_type.to_ast_value(bech32_coder)?, + schema: schema.to_ast_value(bech32_coder)?, metadata: metadata.to_ast_value(bech32_coder)?, access_rules: access_rules.to_ast_value(bech32_coder)?, - initial_supply: initial_supply.to_ast_value(bech32_coder)?, }, - Self::CreateNonFungibleResourceWithOwner { + Self::CreateNonFungibleResourceWithInitialSupply { id_type, + schema, metadata, - owner_badge, + access_rules, initial_supply, - } => ast::Instruction::CreateNonFungibleResourceWithOwner { + } => ast::Instruction::CreateNonFungibleResourceWithInitialSupply { id_type: id_type.to_ast_value(bech32_coder)?, + schema: schema.to_ast_value(bech32_coder)?, metadata: metadata.to_ast_value(bech32_coder)?, - owner_badge: owner_badge.to_ast_value(bech32_coder)?, + access_rules: access_rules.to_ast_value(bech32_coder)?, initial_supply: initial_supply.to_ast_value(bech32_coder)?, }, Self::MintFungible { @@ -840,29 +922,25 @@ impl Instruction { entries, } => ast::Instruction::MintNonFungible { resource_address: resource_address.to_ast_value(bech32_coder)?, - entries: entries.to_ast_value(bech32_coder)?, + args: entries.to_ast_value(bech32_coder)?, }, Self::MintUuidNonFungible { resource_address, entries, } => ast::Instruction::MintUuidNonFungible { resource_address: resource_address.to_ast_value(bech32_coder)?, - entries: entries.to_ast_value(bech32_coder)?, + args: entries.to_ast_value(bech32_coder)?, }, Self::AssertAccessRule { access_rule } => ast::Instruction::AssertAccessRule { access_rule: access_rule.to_ast_value(bech32_coder)?, }, Self::CreateAccessController { controlled_asset, - primary_role, - recovery_role, - confirmation_role, + rule_set, timed_recovery_delay_in_minutes, } => ast::Instruction::CreateAccessController { controlled_asset: controlled_asset.to_ast_value(bech32_coder)?, - primary_role: primary_role.to_ast_value(bech32_coder)?, - recovery_role: recovery_role.to_ast_value(bech32_coder)?, - confirmation_role: confirmation_role.to_ast_value(bech32_coder)?, + rule_set: rule_set.to_ast_value(bech32_coder)?, timed_recovery_delay_in_minutes: timed_recovery_delay_in_minutes .to_ast_value(bech32_coder)?, }, @@ -876,6 +954,9 @@ impl Instruction { key: key.to_ast_value(bech32_coder)?, owner_access_rule: owner_access_rule.to_ast_value(bech32_coder)?, }, + Self::CreateAccount { withdraw_rule } => ast::Instruction::CreateAccount { + withdraw_rule: withdraw_rule.to_ast_value(bech32_coder)?, + }, }; Ok(ast_instruction) } @@ -891,14 +972,14 @@ impl Instruction { function_name, args, } => Self::CallFunction { - package_address: Value::from_ast_value(package_address, bech32_coder)?, - blueprint_name: Value::from_ast_value(blueprint_name, bech32_coder)?, - function_name: Value::from_ast_value(function_name, bech32_coder)?, + package_address: ManifestAstValue::from_ast_value(package_address, bech32_coder)?, + blueprint_name: ManifestAstValue::from_ast_value(blueprint_name, bech32_coder)?, + function_name: ManifestAstValue::from_ast_value(function_name, bech32_coder)?, arguments: { let arguments = args .iter() - .map(|v| Value::from_ast_value(v, bech32_coder)) - .collect::>>()?; + .map(|v| ManifestAstValue::from_ast_value(v, bech32_coder)) + .collect::>>()?; match arguments.len() { 0 => None, _ => Some(arguments), @@ -910,13 +991,16 @@ impl Instruction { method_name, args, } => Self::CallMethod { - component_address: Value::from_ast_value(component_address, bech32_coder)?, - method_name: Value::from_ast_value(method_name, bech32_coder)?, + component_address: ManifestAstValue::from_ast_value( + component_address, + bech32_coder, + )?, + method_name: ManifestAstValue::from_ast_value(method_name, bech32_coder)?, arguments: { let arguments = args .iter() - .map(|v| Value::from_ast_value(v, bech32_coder)) - .collect::>>()?; + .map(|v| ManifestAstValue::from_ast_value(v, bech32_coder)) + .collect::>>()?; match arguments.len() { 0 => None, _ => Some(arguments), @@ -928,72 +1012,75 @@ impl Instruction { resource_address, new_bucket, } => Self::TakeFromWorktop { - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, - into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, + into_bucket: ManifestAstValue::from_ast_value(new_bucket, bech32_coder)?, }, ast::Instruction::TakeFromWorktopByAmount { amount, resource_address, new_bucket, } => Self::TakeFromWorktopByAmount { - amount: Value::from_ast_value(amount, bech32_coder)?, - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, - into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?, + amount: ManifestAstValue::from_ast_value(amount, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, + into_bucket: ManifestAstValue::from_ast_value(new_bucket, bech32_coder)?, }, ast::Instruction::TakeFromWorktopByIds { ids, resource_address, new_bucket, } => Self::TakeFromWorktopByIds { - ids: if let Value::Array { + ids: if let ManifestAstValue::Array { element_kind: _, elements, - } = Value::from_ast_value(ids, bech32_coder)? + } = ManifestAstValue::from_ast_value(ids, bech32_coder)? { - elements.into_iter().collect::>() + elements.into_iter().collect::>() } else { panic!("Expected type Array!") }, - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, - into_bucket: Value::from_ast_value(new_bucket, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, + into_bucket: ManifestAstValue::from_ast_value(new_bucket, bech32_coder)?, }, ast::Instruction::ReturnToWorktop { bucket } => Self::ReturnToWorktop { - bucket: Value::from_ast_value(bucket, bech32_coder)?, + bucket: ManifestAstValue::from_ast_value(bucket, bech32_coder)?, }, ast::Instruction::AssertWorktopContains { resource_address } => { Self::AssertWorktopContains { - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value( + resource_address, + bech32_coder, + )?, } } ast::Instruction::AssertWorktopContainsByAmount { amount, resource_address, } => Self::AssertWorktopContainsByAmount { - amount: Value::from_ast_value(amount, bech32_coder)?, - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + amount: ManifestAstValue::from_ast_value(amount, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, }, ast::Instruction::AssertWorktopContainsByIds { ids, resource_address, } => Self::AssertWorktopContainsByIds { - ids: if let Value::Array { + ids: if let ManifestAstValue::Array { element_kind: _, elements, - } = Value::from_ast_value(ids, bech32_coder)? + } = ManifestAstValue::from_ast_value(ids, bech32_coder)? { - elements.into_iter().collect::>() + elements.into_iter().collect::>() } else { panic!("Expected type Array!") }, - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, }, ast::Instruction::PopFromAuthZone { new_proof } => Self::PopFromAuthZone { - into_proof: Value::from_ast_value(new_proof, bech32_coder)?, + into_proof: ManifestAstValue::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::PushToAuthZone { proof } => Self::PushToAuthZone { - proof: Value::from_ast_value(proof, bech32_coder)?, + proof: ManifestAstValue::from_ast_value(proof, bech32_coder)?, }, ast::Instruction::ClearAuthZone => Self::ClearAuthZone, @@ -1001,214 +1088,217 @@ impl Instruction { resource_address, new_proof, } => Self::CreateProofFromAuthZone { - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, + into_proof: ManifestAstValue::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::CreateProofFromAuthZoneByAmount { amount, resource_address, new_proof, } => Self::CreateProofFromAuthZoneByAmount { - amount: Value::from_ast_value(amount, bech32_coder)?, - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?, + amount: ManifestAstValue::from_ast_value(amount, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, + into_proof: ManifestAstValue::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::CreateProofFromAuthZoneByIds { ids, resource_address, new_proof, } => Self::CreateProofFromAuthZoneByIds { - ids: if let Value::Array { + ids: if let ManifestAstValue::Array { element_kind: _, elements, - } = Value::from_ast_value(ids, bech32_coder)? + } = ManifestAstValue::from_ast_value(ids, bech32_coder)? { - elements.into_iter().collect::>() + elements.into_iter().collect::>() } else { panic!("Expected type Array!") }, - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, + into_proof: ManifestAstValue::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::CreateProofFromBucket { bucket, new_proof } => { Self::CreateProofFromBucket { - bucket: Value::from_ast_value(bucket, bech32_coder)?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?, + bucket: ManifestAstValue::from_ast_value(bucket, bech32_coder)?, + into_proof: ManifestAstValue::from_ast_value(new_proof, bech32_coder)?, } } ast::Instruction::CloneProof { proof, new_proof } => Self::CloneProof { - proof: Value::from_ast_value(proof, bech32_coder)?, - into_proof: Value::from_ast_value(new_proof, bech32_coder)?, + proof: ManifestAstValue::from_ast_value(proof, bech32_coder)?, + into_proof: ManifestAstValue::from_ast_value(new_proof, bech32_coder)?, }, ast::Instruction::DropProof { proof } => Self::DropProof { - proof: Value::from_ast_value(proof, bech32_coder)?, + proof: ManifestAstValue::from_ast_value(proof, bech32_coder)?, }, ast::Instruction::DropAllProofs => Self::DropAllProofs, - ast::Instruction::PublishPackageWithOwner { - code, - abi, - owner_badge, - } => Self::PublishPackageWithOwner { - owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?, - code: Value::from_ast_value(code, bech32_coder)?, - abi: Value::from_ast_value(abi, bech32_coder)?, - }, + ast::Instruction::ClearSignatureProofs => Self::ClearSignatureProofs, ast::Instruction::BurnResource { bucket } => Self::BurnResource { - bucket: Value::from_ast_value(bucket, bech32_coder)?, + bucket: ManifestAstValue::from_ast_value(bucket, bech32_coder)?, }, ast::Instruction::PublishPackage { code, - abi, + schema, royalty_config, metadata, access_rules, } => Self::PublishPackage { - code: Value::from_ast_value(code, bech32_coder)?, - abi: Value::from_ast_value(abi, bech32_coder)?, - royalty_config: Value::from_ast_value(royalty_config, bech32_coder)?, - metadata: Value::from_ast_value(metadata, bech32_coder)?, - access_rules: Value::from_ast_value(access_rules, bech32_coder)?, + code: ManifestAstValue::from_ast_value(code, bech32_coder)?, + schema: ManifestAstValue::from_ast_value(schema, bech32_coder)?, + royalty_config: ManifestAstValue::from_ast_value(royalty_config, bech32_coder)?, + metadata: ManifestAstValue::from_ast_value(metadata, bech32_coder)?, + access_rules: ManifestAstValue::from_ast_value(access_rules, bech32_coder)?, }, ast::Instruction::RecallResource { vault_id, amount } => Self::RecallResource { - vault_id: Value::from_ast_value(vault_id, bech32_coder)?, - amount: Value::from_ast_value(amount, bech32_coder)?, + vault_id: ManifestAstValue::from_ast_value(vault_id, bech32_coder)?, + amount: ManifestAstValue::from_ast_value(amount, bech32_coder)?, }, ast::Instruction::SetMetadata { entity_address, key, value, } => Self::SetMetadata { - entity_address: Value::from_ast_value(entity_address, bech32_coder)?, - key: Value::from_ast_value(key, bech32_coder)?, - value: Value::from_ast_value(value, bech32_coder)?, + entity_address: ManifestAstValue::from_ast_value(entity_address, bech32_coder)?, + key: ManifestAstValue::from_ast_value(key, bech32_coder)?, + value: ManifestAstValue::from_ast_value(value, bech32_coder)?, + }, + + ast::Instruction::RemoveMetadata { + entity_address, + key, + } => Self::RemoveMetadata { + entity_address: ManifestAstValue::from_ast_value(entity_address, bech32_coder)?, + key: ManifestAstValue::from_ast_value(key, bech32_coder)?, }, ast::Instruction::SetPackageRoyaltyConfig { package_address, royalty_config, } => Self::SetPackageRoyaltyConfig { - package_address: Value::from_ast_value(package_address, bech32_coder)?, - royalty_config: Value::from_ast_value(royalty_config, bech32_coder)?, + package_address: ManifestAstValue::from_ast_value(package_address, bech32_coder)?, + royalty_config: ManifestAstValue::from_ast_value(royalty_config, bech32_coder)?, }, ast::Instruction::SetComponentRoyaltyConfig { component_address, royalty_config, } => Self::SetComponentRoyaltyConfig { - component_address: Value::from_ast_value(component_address, bech32_coder)?, - royalty_config: Value::from_ast_value(royalty_config, bech32_coder)?, + component_address: ManifestAstValue::from_ast_value( + component_address, + bech32_coder, + )?, + royalty_config: ManifestAstValue::from_ast_value(royalty_config, bech32_coder)?, }, ast::Instruction::ClaimPackageRoyalty { package_address } => { Self::ClaimPackageRoyalty { - package_address: Value::from_ast_value(package_address, bech32_coder)?, + package_address: ManifestAstValue::from_ast_value( + package_address, + bech32_coder, + )?, } } ast::Instruction::ClaimComponentRoyalty { component_address } => { Self::ClaimComponentRoyalty { - component_address: Value::from_ast_value(component_address, bech32_coder)?, + component_address: ManifestAstValue::from_ast_value( + component_address, + bech32_coder, + )?, } } ast::Instruction::SetMethodAccessRule { entity_address, - index, key, rule, } => Self::SetMethodAccessRule { - entity_address: Value::from_ast_value(entity_address, bech32_coder)?, - index: Value::from_ast_value(index, bech32_coder)?, - key: Value::from_ast_value(key, bech32_coder)?, - rule: Value::from_ast_value(rule, bech32_coder)?, + entity_address: ManifestAstValue::from_ast_value(entity_address, bech32_coder)?, + key: ManifestAstValue::from_ast_value(key, bech32_coder)?, + rule: ManifestAstValue::from_ast_value(rule, bech32_coder)?, }, ast::Instruction::CreateFungibleResource { divisibility, metadata, access_rules, - initial_supply, } => Self::CreateFungibleResource { - divisibility: Value::from_ast_value(divisibility, bech32_coder)?, - metadata: Value::from_ast_value(metadata, bech32_coder)?, - access_rules: Value::from_ast_value(access_rules, bech32_coder)?, - initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, + divisibility: ManifestAstValue::from_ast_value(divisibility, bech32_coder)?, + metadata: ManifestAstValue::from_ast_value(metadata, bech32_coder)?, + access_rules: ManifestAstValue::from_ast_value(access_rules, bech32_coder)?, }, - ast::Instruction::CreateFungibleResourceWithOwner { + ast::Instruction::CreateFungibleResourceWithInitialSupply { divisibility, metadata, - owner_badge, + access_rules, initial_supply, - } => Self::CreateFungibleResourceWithOwner { - divisibility: Value::from_ast_value(divisibility, bech32_coder)?, - metadata: Value::from_ast_value(metadata, bech32_coder)?, - owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?, - initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, + } => Self::CreateFungibleResourceWithInitialSupply { + divisibility: ManifestAstValue::from_ast_value(divisibility, bech32_coder)?, + metadata: ManifestAstValue::from_ast_value(metadata, bech32_coder)?, + access_rules: ManifestAstValue::from_ast_value(access_rules, bech32_coder)?, + initial_supply: ManifestAstValue::from_ast_value(initial_supply, bech32_coder)?, }, ast::Instruction::CreateNonFungibleResource { id_type, + schema, metadata, access_rules, - initial_supply, } => Self::CreateNonFungibleResource { - id_type: Value::from_ast_value(id_type, bech32_coder)?, - metadata: Value::from_ast_value(metadata, bech32_coder)?, - access_rules: Value::from_ast_value(access_rules, bech32_coder)?, - initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, + id_type: ManifestAstValue::from_ast_value(id_type, bech32_coder)?, + schema: ManifestAstValue::from_ast_value(schema, bech32_coder)?, + metadata: ManifestAstValue::from_ast_value(metadata, bech32_coder)?, + access_rules: ManifestAstValue::from_ast_value(access_rules, bech32_coder)?, }, - ast::Instruction::CreateNonFungibleResourceWithOwner { + ast::Instruction::CreateNonFungibleResourceWithInitialSupply { id_type, + schema, metadata, - owner_badge, + access_rules, initial_supply, - } => Self::CreateNonFungibleResourceWithOwner { - id_type: Value::from_ast_value(id_type, bech32_coder)?, - metadata: Value::from_ast_value(metadata, bech32_coder)?, - owner_badge: Value::from_ast_value(owner_badge, bech32_coder)?, - initial_supply: Value::from_ast_value(initial_supply, bech32_coder)?, + } => Self::CreateNonFungibleResourceWithInitialSupply { + id_type: ManifestAstValue::from_ast_value(id_type, bech32_coder)?, + schema: ManifestAstValue::from_ast_value(schema, bech32_coder)?, + metadata: ManifestAstValue::from_ast_value(metadata, bech32_coder)?, + access_rules: ManifestAstValue::from_ast_value(access_rules, bech32_coder)?, + initial_supply: ManifestAstValue::from_ast_value(initial_supply, bech32_coder)?, }, ast::Instruction::MintFungible { resource_address, amount, } => Self::MintFungible { - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, - amount: Value::from_ast_value(amount, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, + amount: ManifestAstValue::from_ast_value(amount, bech32_coder)?, }, ast::Instruction::MintNonFungible { resource_address, - entries, + args, } => Self::MintNonFungible { - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, - entries: Value::from_ast_value(entries, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, + entries: ManifestAstValue::from_ast_value(args, bech32_coder)?, }, ast::Instruction::MintUuidNonFungible { resource_address, - entries, + args, } => Self::MintUuidNonFungible { - resource_address: Value::from_ast_value(resource_address, bech32_coder)?, - entries: Value::from_ast_value(entries, bech32_coder)?, + resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, + entries: ManifestAstValue::from_ast_value(args, bech32_coder)?, }, ast::Instruction::CreateIdentity { access_rule } => Self::CreateIdentity { - access_rule: Value::from_ast_value(access_rule, bech32_coder)?, + access_rule: ManifestAstValue::from_ast_value(access_rule, bech32_coder)?, }, ast::Instruction::AssertAccessRule { access_rule } => Self::AssertAccessRule { - access_rule: Value::from_ast_value(access_rule, bech32_coder)?, + access_rule: ManifestAstValue::from_ast_value(access_rule, bech32_coder)?, }, ast::Instruction::CreateAccessController { controlled_asset, - primary_role, - recovery_role, - confirmation_role, + rule_set, timed_recovery_delay_in_minutes, } => Self::CreateAccessController { - controlled_asset: Value::from_ast_value(controlled_asset, bech32_coder)?, - primary_role: Value::from_ast_value(primary_role, bech32_coder)?, - recovery_role: Value::from_ast_value(recovery_role, bech32_coder)?, - confirmation_role: Value::from_ast_value(confirmation_role, bech32_coder)?, - timed_recovery_delay_in_minutes: Value::from_ast_value( + controlled_asset: ManifestAstValue::from_ast_value(controlled_asset, bech32_coder)?, + rule_set: ManifestAstValue::from_ast_value(rule_set, bech32_coder)?, + timed_recovery_delay_in_minutes: ManifestAstValue::from_ast_value( timed_recovery_delay_in_minutes, bech32_coder, )?, @@ -1217,8 +1307,14 @@ impl Instruction { key, owner_access_rule, } => Self::CreateValidator { - key: Value::from_ast_value(key, bech32_coder)?, - owner_access_rule: Value::from_ast_value(owner_access_rule, bech32_coder)?, + key: ManifestAstValue::from_ast_value(key, bech32_coder)?, + owner_access_rule: ManifestAstValue::from_ast_value( + owner_access_rule, + bech32_coder, + )?, + }, + ast::Instruction::CreateAccount { withdraw_rule } => Self::CreateAccount { + withdraw_rule: ManifestAstValue::from_ast_value(withdraw_rule, bech32_coder)?, }, }; Ok(instruction) diff --git a/radix-engine-toolkit/src/model/mod.rs b/radix-engine-toolkit/src/model/mod.rs index 5c6e1402..c33a6e6c 100644 --- a/radix-engine-toolkit/src/model/mod.rs +++ b/radix-engine-toolkit/src/model/mod.rs @@ -20,15 +20,7 @@ pub mod constants; pub mod crypto; pub mod engine_identifier; pub mod instruction; +pub mod resource_specifier; pub mod runtime; pub mod transaction; pub mod value; - -pub use address::*; -pub use constants::*; -pub use crypto::*; -pub use engine_identifier::*; -pub use instruction::*; -pub use runtime::*; -pub use transaction::*; -pub use value::*; diff --git a/radix-engine-toolkit/src/model/resource_specifier.rs b/radix-engine-toolkit/src/model/resource_specifier.rs new file mode 100644 index 00000000..959e5f3f --- /dev/null +++ b/radix-engine-toolkit/src/model/resource_specifier.rs @@ -0,0 +1,60 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::model::address::EntityAddress; +use scrypto::prelude::{Decimal, NonFungibleLocalId}; +use std::collections::BTreeSet; +use toolkit_derive::serializable; + +use super::address::NetworkAwareResourceAddress; + +/// Specifies resources either through amounts for fungible and non-fungible resources or through +/// ids for non-fungible resources. +#[serializable] +#[derive(PartialEq, PartialOrd, Eq, Ord)] +#[serde(tag = "type")] +pub enum ResourceSpecifier { + // Specifies resources using a decimal quantity. + Amount { + /// The resource address associated with the resource + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The amount of resources withdrawn from the account. This is a decimal value which is + /// serialized as a string. + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + amount: Decimal, + }, + // Specifies resources through a set of non-fungible local id. + Ids { + /// The resource address associated with the resource + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + /// The set of non-fungible ids + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "BTreeSet")] + #[serde_as( + as = "BTreeSet>" + )] + ids: BTreeSet, + }, +} diff --git a/radix-engine-toolkit/src/model/runtime/blob.rs b/radix-engine-toolkit/src/model/runtime/blob.rs index 963dc375..b29246e4 100644 --- a/radix-engine-toolkit/src/model/runtime/blob.rs +++ b/radix-engine-toolkit/src/model/runtime/blob.rs @@ -15,11 +15,10 @@ // specific language governing permissions and limitations // under the License. -use scrypto::prelude::Hash; -use scrypto::runtime::ManifestBlobRef; -use serializable::serializable; +use scrypto::prelude::ManifestBlobRef; +use toolkit_derive::serializable; -use crate::RADIX_ENGINE_HASH_LENGTH; +use crate::model::constants::RADIX_ENGINE_HASH_LENGTH; #[serializable] /// Represents the hash of a blob provided as part of a transaction manifest. This is represented as @@ -34,12 +33,12 @@ pub struct Blob( impl From for Blob { fn from(value: ManifestBlobRef) -> Self { - Self(value.0 .0) + Self(value.0) } } impl From for ManifestBlobRef { fn from(value: Blob) -> Self { - Self(Hash(value.0)) + Self(value.0) } } diff --git a/radix-engine-toolkit/src/model/runtime/expression.rs b/radix-engine-toolkit/src/model/runtime/expression.rs index 14bcca3f..682e5573 100644 --- a/radix-engine-toolkit/src/model/runtime/expression.rs +++ b/radix-engine-toolkit/src/model/runtime/expression.rs @@ -15,8 +15,8 @@ // specific language governing permissions and limitations // under the License. -use scrypto::runtime::ManifestExpression; -use serializable::serializable; +use scrypto::prelude::ManifestExpression; +use toolkit_derive::serializable; #[serializable] #[serde(rename_all = "SCREAMING_SNAKE_CASE")] diff --git a/radix-engine-toolkit/src/model/transaction/header.rs b/radix-engine-toolkit/src/model/transaction/header.rs index 444e3f5d..d9ae72bb 100644 --- a/radix-engine-toolkit/src/model/transaction/header.rs +++ b/radix-engine-toolkit/src/model/transaction/header.rs @@ -16,10 +16,14 @@ // under the License. use native_transaction::model as native; -use serializable::serializable; +use toolkit_derive::serializable; /// A transaction header containing metadata and other transaction information. #[serializable] +#[schemars( + example = "crate::example::transaction::header::header1", + example = "crate::example::transaction::header::header2" +)] pub struct TransactionHeader { /// An 8 bit unsigned integer serialized as a string which represents the transaction version. /// Currently, this value is always 1. diff --git a/radix-engine-toolkit/src/model/transaction/instruction_list.rs b/radix-engine-toolkit/src/model/transaction/instruction_list.rs index 8ff2a329..be9c13cc 100644 --- a/radix-engine-toolkit/src/model/transaction/instruction_list.rs +++ b/radix-engine-toolkit/src/model/transaction/instruction_list.rs @@ -15,13 +15,13 @@ // specific language governing permissions and limitations // under the License. -use crate::address::Bech32Coder; use crate::error::Result; -use crate::model::Instruction; +use crate::model::address::Bech32Coder; +use crate::model::instruction::Instruction; use native_transaction::manifest::{ast, decompile}; use native_transaction::model as transaction; use scrypto::prelude::hash; -use serializable::serializable; +use toolkit_derive::serializable; // ================= // Model Definition @@ -34,7 +34,9 @@ use serializable::serializable; #[serializable] #[serde(tag = "type", content = "value")] pub enum InstructionList { + #[schemars(example = "crate::example::transaction::instruction_list::string")] String(String), + #[schemars(example = "crate::example::transaction::instruction_list::parsed")] Parsed(Vec), } @@ -82,7 +84,7 @@ impl InstructionList { // TODO: This is a work around for a larger issue. Should definitely be removed in the // future. The problem is described in the long comment below. blobs: Vec>, - ) -> Result> { + ) -> Result> { let instructions = self.ast_instructions(bech32_coder)?; let instructions = native_transaction::manifest::generator::generate_manifest( &instructions, @@ -107,17 +109,17 @@ impl InstructionList { // understood by the radix transaction manifest compiler is by going through a // series of steps: // - // Vec -> Vec -> Vec + // Vec -> Vec -> Vec // -> String // // This long conversion is because we would like to use the decompiler provided by // the Scrypto repo. // - // Q. Why not just implement a Instruction -> transaction::BasicInstruction + // Q. Why not just implement a Instruction -> transaction::Instruction // conversion and skip the ast::Instruction phase? // A. Because the IdValidator and id validation in general takes place when the // instruction is being converted from ast::Instruction -> - // transaction::BasicInstruction. If i implement my own conversion + // transaction::Instruction. If i implement my own conversion // (which is easy) then I lose out on the benefits of running the id // validator on transactions and the validation that it performs. // @@ -142,11 +144,11 @@ impl InstructionList { // So, while in the long term, a better solution is for sure needed and required, // we should not immediately do something about this. - // Vec --> Vec --> Vec + // Vec --> Vec --> Vec // Conversion (based on above comment). let instructions = self.basic_instructions(bech32_coder, blobs)?; - // Vec --> String Conversion (based on above comment) + // Vec --> String Conversion (based on above comment) Ok(Self::String(decompile( &instructions, bech32_coder.network_definition(), diff --git a/radix-engine-toolkit/src/model/transaction/intent.rs b/radix-engine-toolkit/src/model/transaction/intent.rs index 47fec970..51accf8c 100644 --- a/radix-engine-toolkit/src/model/transaction/intent.rs +++ b/radix-engine-toolkit/src/model/transaction/intent.rs @@ -15,13 +15,15 @@ // specific language governing permissions and limitations // under the License. -use scrypto::prelude::{scrypto_decode, scrypto_encode}; -use serializable::serializable; +use scrypto::prelude::{manifest_decode, manifest_encode}; +use toolkit_derive::serializable; -use crate::address::Bech32Coder; +use crate::error::Error; use crate::error::Result; +use crate::model::address::Bech32Coder; +use crate::model::transaction::InstructionKind; use crate::model::transaction::{TransactionHeader, TransactionManifest}; -use crate::{CompilableIntent, Error, InstructionKind}; +use crate::traits::CompilableIntent; use native_transaction::model as native; // ================= @@ -31,6 +33,7 @@ use native_transaction::model as native; /// A transaction intent which is made of the header containing the transaction metadata and a /// manifest consisting of the instructions and blobs. #[serializable] +#[schemars(example = "crate::example::transaction::transaction_structure::intent")] pub struct TransactionIntent { /// A transaction header of the transaction metadata. pub header: TransactionHeader, @@ -46,7 +49,7 @@ pub struct TransactionIntent { impl CompilableIntent for TransactionIntent { fn compile(&self) -> Result> { self.to_native_transaction_intent() - .and_then(|intent| scrypto_encode(&intent).map_err(Error::from)) + .and_then(|intent| manifest_encode(&intent).map_err(Error::from)) } fn decompile(data: &T, instructions_kind: InstructionKind) -> Result @@ -54,7 +57,7 @@ impl CompilableIntent for TransactionIntent { Self: Sized, T: AsRef<[u8]>, { - scrypto_decode(data.as_ref()) + manifest_decode(data.as_ref()) .map_err(Error::from) .and_then(|decoded| Self::from_native_transaction_intent(&decoded, instructions_kind)) } diff --git a/radix-engine-toolkit/src/model/transaction/manifest.rs b/radix-engine-toolkit/src/model/transaction/manifest.rs index adffaa41..d285441e 100644 --- a/radix-engine-toolkit/src/model/transaction/manifest.rs +++ b/radix-engine-toolkit/src/model/transaction/manifest.rs @@ -15,11 +15,12 @@ // specific language governing permissions and limitations // under the License. -use crate::error::Result; -use crate::{Bech32Coder, Error, InstructionKind, InstructionList}; +use crate::error::{Error, Result}; +use crate::model::address::Bech32Coder; +use crate::model::transaction::{InstructionKind, InstructionList}; use native_transaction::manifest::decompile; use native_transaction::model as native; -use serializable::serializable; +use toolkit_derive::serializable; // ================= // Model Definition @@ -27,6 +28,7 @@ use serializable::serializable; /// A transaction intent consisting of instructions as well as blobs #[serializable] +#[schemars(example = "crate::example::transaction::transaction_structure::manifest")] pub struct TransactionManifest { /// The transaction manifest instructions to be executed in the transaction. pub instructions: InstructionList, diff --git a/radix-engine-toolkit/src/model/transaction/notarized_intent.rs b/radix-engine-toolkit/src/model/transaction/notarized_intent.rs index 1ddf8fc1..abdf57e3 100644 --- a/radix-engine-toolkit/src/model/transaction/notarized_intent.rs +++ b/radix-engine-toolkit/src/model/transaction/notarized_intent.rs @@ -15,12 +15,12 @@ // specific language governing permissions and limitations // under the License. -use crate::{error::Result, CompilableIntent, Error, InstructionKind}; +use crate::error::{Error, Result}; +use crate::model::transaction::{InstructionKind, SignedTransactionIntent}; +use crate::traits::CompilableIntent; use native_transaction::model as native; -use scrypto::prelude::{scrypto_decode, scrypto_encode, Signature}; -use serializable::serializable; - -use crate::SignedTransactionIntent; +use scrypto::prelude::{manifest_decode, manifest_encode}; +use toolkit_derive::serializable; // ================= // Model Definition @@ -29,6 +29,7 @@ use crate::SignedTransactionIntent; /// A notarized transaction intent which is made up of a signed transaction intent and the notary /// intent on said signed intent. #[serializable] +#[schemars(example = "crate::example::transaction::transaction_structure::notarized_intent")] pub struct NotarizedTransaction { /// The signed transaction intent of the transaction. pub signed_intent: SignedTransactionIntent, @@ -36,7 +37,7 @@ pub struct NotarizedTransaction { /// The signature of the notary on the signed transaction intent. #[schemars(with = "crate::model::crypto::Signature")] #[serde_as(as = "serde_with::FromInto")] - pub notary_signature: Signature, + pub notary_signature: native::Signature, } // =============== @@ -47,7 +48,7 @@ impl CompilableIntent for NotarizedTransaction { fn compile(&self) -> Result> { self.to_native_notarized_transaction_intent() .and_then(|notarized_transaction| { - scrypto_encode(¬arized_transaction).map_err(Error::from) + manifest_encode(¬arized_transaction).map_err(Error::from) }) } @@ -56,7 +57,7 @@ impl CompilableIntent for NotarizedTransaction { Self: Sized, T: AsRef<[u8]>, { - scrypto_decode(data.as_ref()) + manifest_decode(data.as_ref()) .map_err(Error::from) .and_then(|decoded| { Self::from_native_notarized_transaction_intent(&decoded, instructions_kind) diff --git a/radix-engine-toolkit/src/model/transaction/signed_intent.rs b/radix-engine-toolkit/src/model/transaction/signed_intent.rs index a7c568b8..ead2750b 100644 --- a/radix-engine-toolkit/src/model/transaction/signed_intent.rs +++ b/radix-engine-toolkit/src/model/transaction/signed_intent.rs @@ -15,12 +15,12 @@ // specific language governing permissions and limitations // under the License. -use crate::{error::Result, CompilableIntent, Error}; +use crate::error::{Error, Result}; +use crate::model::transaction::{InstructionKind, TransactionIntent}; +use crate::traits::CompilableIntent; use native_transaction::model as native; -use scrypto::prelude::{scrypto_decode, scrypto_encode, SignatureWithPublicKey}; -use serializable::serializable; - -use crate::{InstructionKind, TransactionIntent}; +use scrypto::prelude::{manifest_decode, manifest_encode}; +use toolkit_derive::serializable; // ================= // Model Definition @@ -28,6 +28,7 @@ use crate::{InstructionKind, TransactionIntent}; /// A signed transaction intent which is made up of the intent as well as the intent signatures. #[serializable] +#[schemars(example = "crate::example::transaction::transaction_structure::signed_intent")] pub struct SignedTransactionIntent { /// The intent of the transaction. pub intent: TransactionIntent, @@ -35,7 +36,7 @@ pub struct SignedTransactionIntent { /// A vector of transaction intent signatures. #[schemars(with = "Vec")] #[serde_as(as = "Vec>")] - pub intent_signatures: Vec, + pub intent_signatures: Vec, } // =============== @@ -45,7 +46,7 @@ pub struct SignedTransactionIntent { impl CompilableIntent for SignedTransactionIntent { fn compile(&self) -> Result> { self.to_native_signed_transaction_intent() - .and_then(|intent| scrypto_encode(&intent).map_err(Error::from)) + .and_then(|intent| manifest_encode(&intent).map_err(Error::from)) } fn decompile(data: &T, instructions_kind: InstructionKind) -> Result @@ -53,7 +54,7 @@ impl CompilableIntent for SignedTransactionIntent { Self: Sized, T: AsRef<[u8]>, { - scrypto_decode(data.as_ref()) + manifest_decode(data.as_ref()) .map_err(Error::from) .and_then(|decoded| { Self::from_native_signed_transaction_intent(&decoded, instructions_kind) diff --git a/radix-engine-toolkit/src/model/transaction/validation_config.rs b/radix-engine-toolkit/src/model/transaction/validation_config.rs index d843bfa3..1dc0b91e 100644 --- a/radix-engine-toolkit/src/model/transaction/validation_config.rs +++ b/radix-engine-toolkit/src/model/transaction/validation_config.rs @@ -17,7 +17,7 @@ use native_transaction::validation::ValidationConfig as NativeValidationConfig; use serde_with::{serde_as, DisplayFromStr}; -use serializable::serializable; +use toolkit_derive::serializable; /// Represents a set of settings to use when statically validating a notarized transaction intent. #[serializable] diff --git a/radix-engine-toolkit/src/model/value.rs b/radix-engine-toolkit/src/model/value.rs deleted file mode 100644 index 4ab43980..00000000 --- a/radix-engine-toolkit/src/model/value.rs +++ /dev/null @@ -1,1552 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -use crate::address::*; -use crate::engine_identifier::{BucketId, ProofId}; -use crate::enum_discriminator::EnumDiscriminator; -use crate::error::{Error, Result}; -use crate::TransientIdentifier; -use native_transaction::manifest::{ast, KNOWN_ENUM_DISCRIMINATORS}; - -use native_transaction::manifest::generator::GeneratorError; -use scrypto::prelude::ScryptoCustomValue; -use scrypto::prelude::{ - scrypto_decode, scrypto_encode, Decimal, EcdsaSecp256k1PublicKey, EcdsaSecp256k1Signature, - EddsaEd25519PublicKey, EddsaEd25519Signature, Hash, NonFungibleLocalId, PreciseDecimal, - ScryptoCustomValueKind, ScryptoValue, ScryptoValueKind, -}; -use scrypto::runtime::{ManifestBlobRef, ManifestExpression, Own}; -use serde_with::serde_as; -use serializable::serializable; - -/// The Value model used to describe all of the types that the Radix Engine Toolkit accepts and -/// returns. -#[serializable] -#[serde(tag = "type")] -#[derive(Hash, Eq, PartialEq)] -pub enum Value { - /// A boolean value which can either be true or false - Bool { value: bool }, - - /// An 8-bit unsigned integer which is serialized and deserialized as a string. - U8 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: u8, - }, - - /// A 16-bit unsigned integer which is serialized and deserialized as a string. - U16 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: u16, - }, - - /// A 32-bit unsigned integer which is serialized and deserialized as a string. - U32 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: u32, - }, - - /// A 64-bit unsigned integer which is serialized and deserialized as a string. - U64 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: u64, - }, - - /// A 128-bit unsigned integer which is serialized and deserialized as a string. - U128 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: u128, - }, - - /// An 8-bit signed integer which is serialized and deserialized as a string. - I8 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: i8, - }, - - /// A 16-bit signed integer which is serialized and deserialized as a string. - I16 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: i16, - }, - - /// A 32-bit signed integer which is serialized and deserialized as a string. - I32 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: i32, - }, - - /// A 64-bit signed integer which is serialized and deserialized as a string. - I64 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: i64, - }, - - /// A 128-bit signed integer which is serialized and deserialized as a string. - I128 { - #[schemars(regex(pattern = "[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: i128, - }, - - /// A type representing a string - String { value: String }, - - /// A Rust-style Enum which has a variant and can optionally also have a list of values (acting - /// in a way similar to discriminated algebraic sum types) - Enum { - /// The name of the variant of the enum - variant: EnumDiscriminator, - - /// Optional fields that the enum may have - #[serde(default, skip_serializing_if = "Option::is_none")] - fields: Option>, - }, - - /// The `Some` case of Rust Options where the value is some Value - Some { value: Box }, - - /// The `None` case of Rust Options where there is value - None, - - /// The `Ok` case of Rust Results where the value is some Value - Ok { value: Box }, - - /// The `Err` case of Rust Results where the value is some Value - Err { value: Box }, - - /// An array values of a single value kind - Array { - /// The kind of elements that the array contains. An array will be validated to ensure that - /// it contains a single element kind. - element_kind: ValueKind, - - /// The elements of the array which may contain 0 or more elements. - elements: Vec, - }, - - /// A key-value map of values where all keys are of a single kind and all values are of a - /// single kind - Map { - /// The kind of the keys used for the map. A map will be validated to ensure that its keys - /// are all of a single kind. - key_value_kind: ValueKind, - - /// The kind of the values used for the map. A map will be validated to ensure that its - /// values are all of a single kind. - value_value_kind: ValueKind, - - /// A vector of tuples representing the entires in the map where each tuple is made up of - /// two elements: a key and a value. - entries: Vec<(Value, Value)>, - }, - - /// An array of elements where elements could be of different kinds. - Tuple { elements: Vec }, - - /// A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum - /// of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and - /// -57896044618658097711785492504343953926634992332820282019728.792003956564819968 - /// respectively - Decimal { - #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: Decimal, - }, - - /// A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and - /// minimum of - /// 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. - /// 9083451713845015929093243025426876941405973284973216824503042047 - /// and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 - /// respectively - PreciseDecimal { - #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: PreciseDecimal, - }, - - /// Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of - /// the transaction manifest. - Own { - #[schemars(with = "crate::Own")] - #[serde_as(as = "serde_with::FromInto")] - value: Own, - }, - - /// Represents a Bech32m encoded human-readable component address. This address is serialized - /// as a human-readable bech32m encoded string. - ComponentAddress { - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - address: NetworkAwareComponentAddress, - }, - - /// Represents a Bech32m encoded human-readable resource address. This address is serialized - /// as a human-readable bech32m encoded string. - ResourceAddress { - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - address: NetworkAwareResourceAddress, - }, - - /// Represents a Bech32m encoded human-readable package address. This address is serialized - /// as a human-readable bech32m encoded string. - PackageAddress { - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - address: NetworkAwarePackageAddress, - }, - - /// Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The - /// hashing function that they use is SHA256 which produces 32 byte long hashes which are - /// serialized as a 64 character long hex string (since hex encoding doubles the Integer of - /// bytes needed) - Hash { - #[schemars(length(equal = 64))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: Hash, - }, - - /// A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string - /// representing a public key from the ECDSA Secp256k1 elliptic curve. - EcdsaSecp256k1PublicKey { - #[schemars(length(equal = 66))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - public_key: EcdsaSecp256k1PublicKey, - }, - - /// A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string - /// representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on - /// ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] - /// where `v` is the recovery id and is a single byte and `r` and `s` are the signature results - /// and are 32 bytes each. - EcdsaSecp256k1Signature { - #[schemars(length(equal = 130))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - signature: EcdsaSecp256k1Signature, - }, - - /// A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string - /// representing a public key from the EDDSA Ed25519 edwards curve. - EddsaEd25519PublicKey { - #[schemars(length(equal = 64))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - public_key: EddsaEd25519PublicKey, - }, - - /// A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string - /// representing a signature from the EDDSA Ed25519 edwards curve. - EddsaEd25519Signature { - #[schemars(length(equal = 128))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - signature: EddsaEd25519Signature, - }, - - /// Represents a Scrypto bucket which is identified through a transient identifier which is - /// either a string or an unsigned 32-bit integer which is serialized as a Integer. - Bucket { identifier: BucketId }, - - /// Represents a Scrypto proof which is identified through a transient identifier which is - /// either a string or an unsigned 32-bit integer which is serialized as a Integer. - Proof { identifier: ProofId }, - - /// Represents non-fungible ids which is a discriminated union of the different types that - /// non-fungible ids may be. - NonFungibleLocalId { - #[schemars(with = "crate::NonFungibleLocalId")] - #[serde_as(as = "serde_with::TryFromInto")] - value: NonFungibleLocalId, - }, - - /// Represents a non-fungible address which may be considered as the "global" address of a - /// non-fungible unit as it contains both the resource address and the non-fungible id for that - /// unit. - NonFungibleGlobalId { - #[serde(flatten)] - address: NonFungibleGlobalId, - }, - - /// Represents a transaction manifest expression. - Expression { - #[schemars(with = "crate::Expression")] - #[serde_as(as = "serde_with::FromInto")] - value: ManifestExpression, - }, - - /// Represents the hash of a blob provided as part of a transaction manifest. This is - /// represented as a byte array of 32 bytes which is serialized as a hex string. - Blob { - #[schemars(with = "crate::Blob")] - #[serde_as(as = "serde_with::FromInto")] - hash: ManifestBlobRef, - }, - - /// Represents a byte array of an unknown size which is serialized as a hex string - Bytes { - #[serde_as(as = "serde_with::hex::Hex")] - #[schemars(with = "String")] - value: Vec, - }, -} - -/// An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is -/// essentially the `type` tags used for the value model. -#[serializable] -#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub enum ValueKind { - Bool, - - U8, - U16, - U32, - U64, - U128, - - I8, - I16, - I32, - I64, - I128, - - String, - - Enum, - - Some, - None, - Ok, - Err, - - Map, - Array, - Tuple, - - Decimal, - PreciseDecimal, - - Own, - - ComponentAddress, - ResourceAddress, - PackageAddress, - - Hash, - - EcdsaSecp256k1PublicKey, - EcdsaSecp256k1Signature, - EddsaEd25519PublicKey, - EddsaEd25519Signature, - - Bucket, - Proof, - - NonFungibleLocalId, - NonFungibleGlobalId, - - Expression, - Blob, - Bytes, -} - -impl Value { - /// SBOR Encodes a [`Value`]. - pub fn encode(&self) -> Result> { - // Convert the value first to a Scrypto value - let scrypto_value = self.to_scrypto_value()?; - - // SBOR encode the Scrypto Value and return the result - scrypto_encode(&scrypto_value).map_err(Error::from) - } - - /// Decodes an SBOR payload to a [`Value`] given the network context. - pub fn decode>(bytes: T, network_id: u8) -> Result { - scrypto_decode::(bytes.as_ref()) - .map(|scrypto_value| Self::from_scrypto_value(&scrypto_value, network_id)) - .map_err(Error::from) - } - - /// Gets the [`ValueKind`] for the given value - pub fn kind(&self) -> ValueKind { - match self { - Self::Bool { .. } => ValueKind::Bool, - - Self::I8 { .. } => ValueKind::I8, - Self::I16 { .. } => ValueKind::I16, - Self::I32 { .. } => ValueKind::I32, - Self::I64 { .. } => ValueKind::I64, - Self::I128 { .. } => ValueKind::I128, - - Self::U8 { .. } => ValueKind::U8, - Self::U16 { .. } => ValueKind::U16, - Self::U32 { .. } => ValueKind::U32, - Self::U64 { .. } => ValueKind::U64, - Self::U128 { .. } => ValueKind::U128, - - Self::String { .. } => ValueKind::String, - - Self::Enum { .. } => ValueKind::Enum, - - Self::Some { .. } => ValueKind::Some, - Self::None => ValueKind::None, - Self::Ok { .. } => ValueKind::Ok, - Self::Err { .. } => ValueKind::Err, - - Self::Map { .. } => ValueKind::Map, - Self::Array { .. } => ValueKind::Array, - Self::Tuple { .. } => ValueKind::Tuple, - - Self::Decimal { .. } => ValueKind::Decimal, - Self::PreciseDecimal { .. } => ValueKind::PreciseDecimal, - - Self::PackageAddress { .. } => ValueKind::PackageAddress, - Self::ComponentAddress { .. } => ValueKind::ComponentAddress, - Self::ResourceAddress { .. } => ValueKind::ResourceAddress, - - Self::Hash { .. } => ValueKind::Hash, - - Self::Bucket { .. } => ValueKind::Bucket, - Self::Proof { .. } => ValueKind::Proof, - - Self::NonFungibleLocalId { .. } => ValueKind::NonFungibleLocalId, - Self::NonFungibleGlobalId { .. } => ValueKind::NonFungibleGlobalId, - - Self::EcdsaSecp256k1PublicKey { .. } => ValueKind::EcdsaSecp256k1PublicKey, - Self::EcdsaSecp256k1Signature { .. } => ValueKind::EcdsaSecp256k1Signature, - Self::EddsaEd25519PublicKey { .. } => ValueKind::EddsaEd25519PublicKey, - Self::EddsaEd25519Signature { .. } => ValueKind::EddsaEd25519Signature, - - Self::Blob { .. } => ValueKind::Blob, - Self::Expression { .. } => ValueKind::Expression, - Self::Bytes { .. } => ValueKind::Bytes, - Self::Own { .. } => ValueKind::Own, - } - } - - /// Converts a [`Value`] to Scrypto's tx compiler's [`ast::Value`] given a bech32 coder as - /// context. - pub fn to_ast_value(&self, bech32_coder: &Bech32Coder) -> Result { - let value = match self { - Value::Bool { value } => ast::Value::Bool(*value), - - Value::I8 { value } => ast::Value::I8(*value), - Value::I16 { value } => ast::Value::I16(*value), - Value::I32 { value } => ast::Value::I32(*value), - Value::I64 { value } => ast::Value::I64(*value), - Value::I128 { value } => ast::Value::I128(*value), - - Value::U8 { value } => ast::Value::U8(*value), - Value::U16 { value } => ast::Value::U16(*value), - Value::U32 { value } => ast::Value::U32(*value), - Value::U64 { value } => ast::Value::U64(*value), - Value::U128 { value } => ast::Value::U128(*value), - - Value::String { value } => ast::Value::String(value.clone()), - - Value::Enum { variant, fields } => ast::Value::Enum( - variant.resolve_discriminator()?, - fields - .clone() - .unwrap_or_default() - .iter() - .map(|value| value.to_ast_value(bech32_coder)) - .collect::>>()?, - ), - Value::Some { value } => ast::Value::Some(Box::new(value.to_ast_value(bech32_coder)?)), - Value::None => ast::Value::None, - Value::Ok { value } => ast::Value::Ok(Box::new(value.to_ast_value(bech32_coder)?)), - Value::Err { value } => ast::Value::Err(Box::new(value.to_ast_value(bech32_coder)?)), - - Value::Array { - element_kind, - elements, - } => ast::Value::Array( - (*element_kind).into(), - elements - .iter() - .map(|id| id.to_ast_value(bech32_coder)) - .collect::>>()?, - ), - Value::Map { - key_value_kind, - value_value_kind, - entries, - } => ast::Value::Map( - (*key_value_kind).into(), - (*value_value_kind).into(), - entries - .iter() - .flat_map(|(x, y)| [x, y]) - .map(|value| value.to_ast_value(bech32_coder)) - .collect::>>()?, - ), - Value::Tuple { elements } => ast::Value::Tuple( - elements - .iter() - .map(|v| v.to_ast_value(bech32_coder)) - .collect::>>()?, - ), - - Value::Decimal { value } => { - ast::Value::Decimal(Box::new(ast::Value::String(value.to_string()))) - } - Value::PreciseDecimal { value } => { - ast::Value::PreciseDecimal(Box::new(ast::Value::String(value.to_string()))) - } - - Value::PackageAddress { address: value } => ast::Value::PackageAddress(Box::new( - ast::Value::String(bech32_coder.encode_package_address(&value.address)), - )), - Value::ComponentAddress { address: value } => ast::Value::ComponentAddress(Box::new( - ast::Value::String(bech32_coder.encode_component_address(&value.address)), - )), - Value::ResourceAddress { address: value } => ast::Value::ResourceAddress(Box::new( - ast::Value::String(bech32_coder.encode_resource_address(&value.address)), - )), - - Value::Hash { value } => { - ast::Value::Hash(Box::new(ast::Value::String(value.to_string()))) - } - Value::Bucket { identifier } => ast::Value::Bucket(Box::new(match identifier.0 { - TransientIdentifier::String { - value: ref identifier, - } => ast::Value::String(identifier.clone()), - TransientIdentifier::U32 { value: identifier } => ast::Value::U32(identifier), - })), - Value::Proof { identifier } => ast::Value::Proof(Box::new(match identifier.0 { - TransientIdentifier::String { - value: ref identifier, - } => ast::Value::String(identifier.clone()), - TransientIdentifier::U32 { value: identifier } => ast::Value::U32(identifier), - })), - - Value::NonFungibleLocalId { value } => { - ast::Value::NonFungibleLocalId(Box::new(ast::Value::String(value.to_string()))) - } - Value::NonFungibleGlobalId { address } => { - let nf_global_id_string = format!( - "{}:{}", - bech32_coder.encode_resource_address(&address.resource_address.address), - address.non_fungible_local_id - ); - ast::Value::NonFungibleGlobalId(Box::new(ast::Value::String(nf_global_id_string))) - } - - Value::Blob { hash } => { - ast::Value::Blob(Box::new(ast::Value::String(hash.0.to_string()))) - } - Value::Expression { value } => { - ast::Value::Expression(Box::new(ast::Value::String(match value { - ManifestExpression::EntireWorktop => "ENTIRE_WORKTOP".into(), - ManifestExpression::EntireAuthZone => "ENTIRE_AUTH_ZONE".into(), - }))) - } - - Value::EcdsaSecp256k1PublicKey { public_key } => ast::Value::EcdsaSecp256k1PublicKey( - Box::new(ast::Value::String(public_key.to_string())), - ), - Value::EcdsaSecp256k1Signature { signature } => ast::Value::EcdsaSecp256k1Signature( - Box::new(ast::Value::String(signature.to_string())), - ), - - Value::EddsaEd25519PublicKey { public_key } => ast::Value::EddsaEd25519PublicKey( - Box::new(ast::Value::String(public_key.to_string())), - ), - Value::EddsaEd25519Signature { signature } => ast::Value::EddsaEd25519Signature( - Box::new(ast::Value::String(signature.to_string())), - ), - Value::Bytes { value } => { - ast::Value::Bytes(Box::new(ast::Value::String(hex::encode(value)))) - } - - Value::Own { value } => { - // TODO: Once the Scrypto codebase is updated for a better "own" representation we - // should also update this - ast::Value::Own(Box::new(ast::Value::String(format!("{:?}", value)))) - } - }; - Ok(value) - } - - /// Converts Scrypto's tx compiler's [`ast::Value`] to a [`Value`] given a bech32 coder as - /// context. - pub fn from_ast_value(value: &ast::Value, bech32_coder: &Bech32Coder) -> Result { - let parsing = ValueKind::from(value.value_kind()); - let value = match value { - ast::Value::Bool(value) => Self::Bool { value: *value }, - - ast::Value::I8(value) => Self::I8 { value: *value }, - ast::Value::I16(value) => Self::I16 { value: *value }, - ast::Value::I32(value) => Self::I32 { value: *value }, - ast::Value::I64(value) => Self::I64 { value: *value }, - ast::Value::I128(value) => Self::I128 { value: *value }, - - ast::Value::U8(value) => Self::U8 { value: *value }, - ast::Value::U16(value) => Self::U16 { value: *value }, - ast::Value::U32(value) => Self::U32 { value: *value }, - ast::Value::U64(value) => Self::U64 { value: *value }, - ast::Value::U128(value) => Self::U128 { value: *value }, - - ast::Value::String(value) => Self::String { - value: value.clone(), - }, - - ast::Value::Enum(variant, fields) => Self::Enum { - variant: EnumDiscriminator::U8 { - discriminator: *variant, - }, - fields: { - if fields.is_empty() { - None - } else { - Some( - fields - .iter() - .map(|value| Self::from_ast_value(value, bech32_coder)) - .collect::>>()?, - ) - } - }, - }, - - ast::Value::Some(value) => Self::Some { - value: Box::new(Self::from_ast_value(value, bech32_coder)?), - }, - ast::Value::None => Self::None, - ast::Value::Ok(value) => Self::Ok { - value: Box::new(Self::from_ast_value(value, bech32_coder)?), - }, - ast::Value::Err(value) => Self::Err { - value: Box::new(Self::from_ast_value(value, bech32_coder)?), - }, - - ast::Value::Map(key_value_kind, value_value_kind, entries) => Self::Map { - key_value_kind: (*key_value_kind).into(), - value_value_kind: (*value_value_kind).into(), - entries: { - // Ensure that we have enough elements for the window operation - if entries.len() % 2 != 0 { - Err(Error::from(GeneratorError::OddNumberOfElements)) - } else { - let mut entries_vec = Vec::new(); - for chunk in entries.chunks(2) { - let key = Self::from_ast_value(&chunk[0], bech32_coder)?; - let value = Self::from_ast_value(&chunk[1], bech32_coder)?; - - entries_vec.push((key, value)); - } - Ok(entries_vec) - } - }?, - }, - ast::Value::Array(ast_type, elements) => Self::Array { - element_kind: (*ast_type).into(), - elements: elements - .iter() - .map(|value| Self::from_ast_value(value, bech32_coder)) - .collect::>>()?, - }, - ast::Value::Tuple(elements) => Self::Tuple { - elements: elements - .iter() - .map(|value| Self::from_ast_value(value, bech32_coder)) - .collect::>>()?, - }, - ast::Value::Decimal(value) => map_if_value_string(parsing, value, |string| { - string - .parse() - .map(|value| Self::Decimal { value }) - .map_err(Error::from) - })?, - ast::Value::PreciseDecimal(value) => map_if_value_string(parsing, value, |string| { - string - .parse() - .map(|value| Self::PreciseDecimal { value }) - .map_err(Error::from) - })?, - ast::Value::PackageAddress(address) => { - map_if_value_string(parsing, address, |address_string| { - bech32_coder - .decode_to_network_aware_package_address(address_string) - .map(|address| Value::PackageAddress { address }) - })? - } - ast::Value::ResourceAddress(address) => { - map_if_value_string(parsing, address, |address_string| { - bech32_coder - .decode_to_network_aware_resource_address(address_string) - .map(|address| Value::ResourceAddress { address }) - })? - } - ast::Value::ComponentAddress(address) => { - map_if_value_string(parsing, address, |address_string| { - bech32_coder - .decode_to_network_aware_component_address(address_string) - .map(|address| Value::ComponentAddress { address }) - })? - } - ast::Value::Hash(value) => map_if_value_string(parsing, value, |string| { - string - .parse() - .map(|value| Self::Hash { value }) - .map_err(Error::from) - })?, - - ast::Value::Bucket(value) => { - if let ast::Value::U32(identifier) = &**value { - Self::Bucket { - identifier: TransientIdentifier::U32 { value: *identifier }.into(), - } - } else if let ast::Value::String(identifier) = &**value { - Self::Bucket { - identifier: TransientIdentifier::String { - value: identifier.to_owned(), - } - .into(), - } - } else { - Err(Error::UnexpectedAstContents { - parsing: ValueKind::Bucket, - expected: vec![ValueKind::U32, ValueKind::String], - found: value.value_kind().into(), - })? - } - } - ast::Value::Proof(value) => { - if let ast::Value::U32(identifier) = &**value { - Self::Proof { - identifier: TransientIdentifier::U32 { value: *identifier }.into(), - } - } else if let ast::Value::String(identifier) = &**value { - Self::Proof { - identifier: TransientIdentifier::String { - value: identifier.clone(), - } - .into(), - } - } else { - Err(Error::UnexpectedAstContents { - parsing: ValueKind::Proof, - expected: vec![ValueKind::U32, ValueKind::String], - found: value.value_kind().into(), - })? - } - } - - ast::Value::NonFungibleLocalId(value) => Self::NonFungibleLocalId { - value: match &**value { - ast::Value::String(value) => value.parse()?, - _ => Err(Error::UnexpectedAstContents { - parsing: ValueKind::NonFungibleLocalId, - expected: vec![ValueKind::String], - found: value.value_kind().into(), - })?, - }, - }, - ast::Value::NonFungibleGlobalId(value) => match &**value { - ast::Value::String(string) => { - let native_global_id = - scrypto::prelude::NonFungibleGlobalId::try_from_canonical_string( - bech32_coder.decoder(), - string, - )?; - Self::NonFungibleGlobalId { - address: NonFungibleGlobalId { - resource_address: NetworkAwareResourceAddress { - network_id: bech32_coder.network_id(), - address: native_global_id.resource_address(), - }, - non_fungible_local_id: native_global_id.local_id().clone(), - }, - } - } - _ => Err(Error::UnexpectedAstContents { - parsing: ValueKind::NonFungibleGlobalId, - expected: vec![ValueKind::String], - found: value.value_kind().into(), - })?, - }, - - ast::Value::Blob(value) => map_if_value_string(parsing, value, |blob_string| { - let bytes = hex::decode(blob_string)?; - ManifestBlobRef::try_from(bytes.as_slice()) - .map(|manifest_blob| Self::Blob { - hash: manifest_blob, - }) - .map_err(Error::from) - })?, - ast::Value::Expression(value) => map_if_value_string( - parsing, - value, - |expression_string| match expression_string { - "ENTIRE_WORKTOP" => Ok(Self::Expression { - value: ManifestExpression::EntireWorktop, - }), - "ENTIRE_AUTH_ZONE" => Ok(Self::Expression { - value: ManifestExpression::EntireAuthZone, - }), - string => Err(Error::InvalidExpressionString { - found: string.to_owned(), - excepted: vec![ - String::from("ENTIRE_WORKTOP"), - String::from("ENTIRE_AUTH_ZONE"), - ], - }), - }, - )?, - - ast::Value::EcdsaSecp256k1PublicKey(value) => { - map_if_value_string(parsing, value, |string| { - string - .parse() - .map(|public_key| Self::EcdsaSecp256k1PublicKey { public_key }) - .map_err(Error::from) - })? - } - ast::Value::EcdsaSecp256k1Signature(value) => { - map_if_value_string(parsing, value, |string| { - string - .parse() - .map(|signature| Self::EcdsaSecp256k1Signature { signature }) - .map_err(Error::from) - })? - } - ast::Value::EddsaEd25519PublicKey(value) => { - map_if_value_string(parsing, value, |string| { - string - .parse() - .map(|public_key| Self::EddsaEd25519PublicKey { public_key }) - .map_err(Error::from) - })? - } - ast::Value::EddsaEd25519Signature(value) => { - map_if_value_string(parsing, value, |string| { - string - .parse() - .map(|signature| Self::EddsaEd25519Signature { signature }) - .map_err(Error::from) - })? - } - - ast::Value::Bytes(value) => map_if_value_string(parsing, value, |string| { - hex::decode(string) - .map_err(Error::from) - .map(|value| Self::Bytes { value }) - })?, - - ast::Value::Own(..) => todo!(), /* TODO: Implement this once we've agreed on the - * format that own is represented in manifests */ - }; - Ok(value) - } - - /// Converts a [`Value`] to a [`ScryptoValue`]. - pub fn to_scrypto_value(&self) -> Result { - let value = match self { - Self::Bool { value } => ScryptoValue::Bool { value: *value }, - - Self::U8 { value } => ScryptoValue::U8 { value: *value }, - Self::U16 { value } => ScryptoValue::U16 { value: *value }, - Self::U32 { value } => ScryptoValue::U32 { value: *value }, - Self::U64 { value } => ScryptoValue::U64 { value: *value }, - Self::U128 { value } => ScryptoValue::U128 { value: *value }, - - Self::I8 { value } => ScryptoValue::I8 { value: *value }, - Self::I16 { value } => ScryptoValue::I16 { value: *value }, - Self::I32 { value } => ScryptoValue::I32 { value: *value }, - Self::I64 { value } => ScryptoValue::I64 { value: *value }, - Self::I128 { value } => ScryptoValue::I128 { value: *value }, - - Self::String { value } => ScryptoValue::String { - value: value.clone(), - }, - Self::Enum { variant, fields } => ScryptoValue::Enum { - discriminator: variant.resolve_discriminator()?, - fields: fields - .clone() - .unwrap_or_default() - .into_iter() - .map(|value| value.to_scrypto_value()) - .collect::>>()?, - }, - Self::Some { value } => ScryptoValue::Enum { - discriminator: *KNOWN_ENUM_DISCRIMINATORS - .get("Option::Some") - .expect("Should never fail!"), - fields: vec![value.to_scrypto_value()?], - }, - Self::None => ScryptoValue::Enum { - discriminator: *KNOWN_ENUM_DISCRIMINATORS - .get("Option::None") - .expect("Should never fail!"), - fields: Vec::new(), - }, - Self::Ok { value } => ScryptoValue::Enum { - discriminator: *KNOWN_ENUM_DISCRIMINATORS - .get("Result::Ok") - .expect("Should never fail!"), - fields: vec![value.to_scrypto_value()?], - }, - Self::Err { value } => ScryptoValue::Enum { - discriminator: *KNOWN_ENUM_DISCRIMINATORS - .get("Result::Err") - .expect("Should never fail!"), - fields: vec![value.to_scrypto_value()?], - }, - Self::Map { - key_value_kind, - value_value_kind, - entries, - } => ScryptoValue::Map { - key_value_kind: (*key_value_kind).into(), - value_value_kind: (*value_value_kind).into(), - entries: { - let mut scrypto_entries = Vec::new(); - for (key, value) in entries { - scrypto_entries.push((key.to_scrypto_value()?, value.to_scrypto_value()?)) - } - scrypto_entries - }, - }, - Self::Array { - element_kind, - elements, - } => ScryptoValue::Array { - element_value_kind: (*element_kind).into(), - elements: elements - .clone() - .into_iter() - .map(|value| value.to_scrypto_value()) - .collect::>>()?, - }, - Self::Tuple { elements } => ScryptoValue::Tuple { - fields: elements - .clone() - .into_iter() - .map(|value| value.to_scrypto_value()) - .collect::>>()?, - }, - - Self::Decimal { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::Decimal(*value), - }, - Self::PreciseDecimal { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::PreciseDecimal(*value), - }, - Self::ComponentAddress { address } => ScryptoValue::Custom { - value: ScryptoCustomValue::ComponentAddress(address.address), - }, - Self::PackageAddress { address } => ScryptoValue::Custom { - value: ScryptoCustomValue::PackageAddress(address.address), - }, - Self::ResourceAddress { address } => ScryptoValue::Custom { - value: ScryptoCustomValue::ResourceAddress(address.address), - }, - - Self::Hash { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::Hash(*value), - }, - - Self::EcdsaSecp256k1PublicKey { public_key } => ScryptoValue::Custom { - value: ScryptoCustomValue::EcdsaSecp256k1PublicKey(*public_key), - }, - Self::EddsaEd25519PublicKey { public_key } => ScryptoValue::Custom { - value: ScryptoCustomValue::EddsaEd25519PublicKey(*public_key), - }, - - Self::EcdsaSecp256k1Signature { signature } => ScryptoValue::Custom { - value: ScryptoCustomValue::EcdsaSecp256k1Signature(*signature), - }, - Self::EddsaEd25519Signature { signature } => ScryptoValue::Custom { - value: ScryptoCustomValue::EddsaEd25519Signature(*signature), - }, - - Self::Bucket { identifier } => ScryptoValue::Custom { - value: identifier.try_into()?, - }, - Self::Proof { identifier } => ScryptoValue::Custom { - value: identifier.try_into()?, - }, - - Self::NonFungibleLocalId { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::NonFungibleLocalId(value.clone()), - }, - Self::NonFungibleGlobalId { address } => ScryptoValue::Tuple { - fields: vec![ - Self::ResourceAddress { - address: address.resource_address, - } - .to_scrypto_value()?, - Self::NonFungibleLocalId { - value: address.non_fungible_local_id.clone(), - } - .to_scrypto_value()?, - ], - }, - - Self::Blob { hash } => ScryptoValue::Custom { - value: ScryptoCustomValue::Blob(hash.clone()), - }, - Self::Expression { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::Expression(value.clone()), - }, - Self::Bytes { value } => ScryptoValue::Array { - element_value_kind: ScryptoValueKind::U8, - elements: value - .clone() - .into_iter() - .map(|value| ScryptoValue::U8 { value }) - .collect(), - }, - - Self::Own { value } => ScryptoValue::Custom { - value: ScryptoCustomValue::Own(value.clone()), - }, - }; - Ok(value) - } - - /// Converts a [`ScryptoValue`] to a [`Value`] given the network id as context. - pub fn from_scrypto_value(scrypto_value: &ScryptoValue, network_id: u8) -> Self { - match scrypto_value { - ScryptoValue::Bool { value } => Self::Bool { value: *value }, - - ScryptoValue::U8 { value } => Self::U8 { value: *value }, - ScryptoValue::U16 { value } => Self::U16 { value: *value }, - ScryptoValue::U32 { value } => Self::U32 { value: *value }, - ScryptoValue::U64 { value } => Self::U64 { value: *value }, - ScryptoValue::U128 { value } => Self::U128 { value: *value }, - - ScryptoValue::I8 { value } => Self::I8 { value: *value }, - ScryptoValue::I16 { value } => Self::I16 { value: *value }, - ScryptoValue::I32 { value } => Self::I32 { value: *value }, - ScryptoValue::I64 { value } => Self::I64 { value: *value }, - ScryptoValue::I128 { value } => Self::I128 { value: *value }, - - ScryptoValue::String { value } => Self::String { - value: value.clone(), - }, - - ScryptoValue::Enum { - discriminator, - fields, - } => Self::Enum { - variant: EnumDiscriminator::U8 { - discriminator: *discriminator, - }, - fields: if fields.is_empty() { - None - } else { - Some( - fields - .clone() - .into_iter() - .map(|value| Self::from_scrypto_value(&value, network_id)) - .collect(), - ) - }, - }, - ScryptoValue::Map { - key_value_kind, - value_value_kind, - entries, - } => Self::Map { - key_value_kind: (*key_value_kind).into(), - value_value_kind: (*value_value_kind).into(), - entries: { - let mut scrypto_entries = Vec::new(); - for (key, value) in entries { - scrypto_entries.push(( - Self::from_scrypto_value(key, network_id), - Self::from_scrypto_value(value, network_id), - )) - } - scrypto_entries - }, - }, - ScryptoValue::Array { - element_value_kind, - elements, - } => Self::Array { - element_kind: (*element_value_kind).into(), - elements: elements - .clone() - .into_iter() - .map(|value| Self::from_scrypto_value(&value, network_id)) - .collect(), - }, - ScryptoValue::Tuple { fields } => Self::Tuple { - elements: fields - .clone() - .into_iter() - .map(|value| Self::from_scrypto_value(&value, network_id)) - .collect(), - }, - - ScryptoValue::Custom { - value: ScryptoCustomValue::PackageAddress(address), - } => Self::PackageAddress { - address: NetworkAwarePackageAddress { - network_id, - address: *address, - }, - }, - ScryptoValue::Custom { - value: ScryptoCustomValue::ResourceAddress(address), - } => Self::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id, - address: *address, - }, - }, - ScryptoValue::Custom { - value: ScryptoCustomValue::ComponentAddress(address), - } => Self::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id, - address: *address, - }, - }, - - ScryptoValue::Custom { - value: ScryptoCustomValue::Bucket(identifier), - } => Self::Bucket { - identifier: TransientIdentifier::U32 { - value: identifier.0, - } - .into(), - }, - ScryptoValue::Custom { - value: ScryptoCustomValue::Proof(identifier), - } => Self::Proof { - identifier: TransientIdentifier::U32 { - value: identifier.0, - } - .into(), - }, - - ScryptoValue::Custom { - value: ScryptoCustomValue::Expression(value), - } => Self::Expression { - value: value.clone(), - }, - ScryptoValue::Custom { - value: ScryptoCustomValue::Blob(value), - } => Self::Blob { - hash: value.clone(), - }, - ScryptoValue::Custom { - value: ScryptoCustomValue::Hash(value), - } => Self::Hash { value: *value }, - - ScryptoValue::Custom { - value: ScryptoCustomValue::EcdsaSecp256k1PublicKey(value), - } => Self::EcdsaSecp256k1PublicKey { public_key: *value }, - ScryptoValue::Custom { - value: ScryptoCustomValue::EddsaEd25519PublicKey(value), - } => Self::EddsaEd25519PublicKey { public_key: *value }, - ScryptoValue::Custom { - value: ScryptoCustomValue::EcdsaSecp256k1Signature(value), - } => Self::EcdsaSecp256k1Signature { signature: *value }, - ScryptoValue::Custom { - value: ScryptoCustomValue::EddsaEd25519Signature(value), - } => Self::EddsaEd25519Signature { signature: *value }, - - ScryptoValue::Custom { - value: ScryptoCustomValue::Decimal(value), - } => Self::Decimal { value: *value }, - ScryptoValue::Custom { - value: ScryptoCustomValue::PreciseDecimal(value), - } => Self::PreciseDecimal { value: *value }, - - ScryptoValue::Custom { - value: ScryptoCustomValue::NonFungibleLocalId(value), - } => Self::NonFungibleLocalId { - value: value.clone(), - }, - - ScryptoValue::Custom { - value: ScryptoCustomValue::Own(value), - } => Self::Own { - value: value.clone(), - }, - } - } -} - -impl From for ast::Type { - fn from(value: ValueKind) -> ast::Type { - match value { - ValueKind::Bool => ast::Type::Bool, - ValueKind::I8 => ast::Type::I8, - ValueKind::I16 => ast::Type::I16, - ValueKind::I32 => ast::Type::I32, - ValueKind::I64 => ast::Type::I64, - ValueKind::I128 => ast::Type::I128, - - ValueKind::U8 => ast::Type::U8, - ValueKind::U16 => ast::Type::U16, - ValueKind::U32 => ast::Type::U32, - ValueKind::U64 => ast::Type::U64, - ValueKind::U128 => ast::Type::U128, - - ValueKind::String => ast::Type::String, - - ValueKind::Enum => ast::Type::Enum, - ValueKind::Some => ast::Type::Enum, - ValueKind::None => ast::Type::Enum, - ValueKind::Ok => ast::Type::Enum, - ValueKind::Err => ast::Type::Enum, - - ValueKind::Map => ast::Type::Array, - ValueKind::Array => ast::Type::Array, - ValueKind::Tuple => ast::Type::Tuple, - - ValueKind::Decimal => ast::Type::Decimal, - ValueKind::PreciseDecimal => ast::Type::PreciseDecimal, - - ValueKind::PackageAddress => ast::Type::PackageAddress, - ValueKind::ComponentAddress => ast::Type::ComponentAddress, - ValueKind::ResourceAddress => ast::Type::ResourceAddress, - - ValueKind::Hash => ast::Type::Hash, - - ValueKind::Bucket => ast::Type::Bucket, - ValueKind::Proof => ast::Type::Proof, - - ValueKind::NonFungibleLocalId => ast::Type::NonFungibleLocalId, - ValueKind::NonFungibleGlobalId => ast::Type::NonFungibleGlobalId, - - ValueKind::Blob => ast::Type::Blob, - ValueKind::Bytes => ast::Type::Bytes, - ValueKind::Expression => ast::Type::Expression, - - ValueKind::EcdsaSecp256k1PublicKey => ast::Type::EcdsaSecp256k1PublicKey, - ValueKind::EcdsaSecp256k1Signature => ast::Type::EcdsaSecp256k1Signature, - ValueKind::EddsaEd25519PublicKey => ast::Type::EddsaEd25519PublicKey, - ValueKind::EddsaEd25519Signature => ast::Type::EddsaEd25519Signature, - ValueKind::Own => ast::Type::Own, - } - } -} - -impl From for ValueKind { - fn from(value: ast::Type) -> ValueKind { - match value { - ast::Type::Bool => Self::Bool, - - ast::Type::I8 => Self::I8, - ast::Type::I16 => Self::I16, - ast::Type::I32 => Self::I32, - ast::Type::I64 => Self::I64, - ast::Type::I128 => Self::I128, - ast::Type::U8 => Self::U8, - ast::Type::U16 => Self::U16, - ast::Type::U32 => Self::U32, - ast::Type::U64 => Self::U64, - ast::Type::U128 => Self::U128, - - ast::Type::String => Self::String, - - ast::Type::Enum => Self::Enum, - - ast::Type::Array => Self::Array, - ast::Type::Tuple => Self::Tuple, - - ast::Type::Decimal => Self::Decimal, - ast::Type::PreciseDecimal => Self::PreciseDecimal, - - ast::Type::PackageAddress => Self::PackageAddress, - ast::Type::ComponentAddress => Self::ComponentAddress, - ast::Type::ResourceAddress => Self::ResourceAddress, - - ast::Type::Hash => Self::Hash, - ast::Type::EcdsaSecp256k1PublicKey => Self::EcdsaSecp256k1PublicKey, - ast::Type::EcdsaSecp256k1Signature => Self::EcdsaSecp256k1Signature, - ast::Type::EddsaEd25519PublicKey => Self::EddsaEd25519PublicKey, - ast::Type::EddsaEd25519Signature => Self::EddsaEd25519Signature, - - ast::Type::Bucket => Self::Bucket, - ast::Type::Proof => Self::Proof, - - ast::Type::NonFungibleLocalId => Self::NonFungibleLocalId, - ast::Type::NonFungibleGlobalId => Self::NonFungibleGlobalId, - - ast::Type::Blob => Self::Blob, - ast::Type::Expression => Self::Expression, - ast::Type::Bytes => Self::Bytes, - ast::Type::Own => Self::Own, - } - } -} - -impl From for ValueKind { - fn from(value: ScryptoValueKind) -> Self { - match value { - ScryptoValueKind::Bool => ValueKind::Bool, - - ScryptoValueKind::U8 => ValueKind::U8, - ScryptoValueKind::U16 => ValueKind::U16, - ScryptoValueKind::U32 => ValueKind::U32, - ScryptoValueKind::U64 => ValueKind::U64, - ScryptoValueKind::U128 => ValueKind::U128, - - ScryptoValueKind::I8 => ValueKind::I8, - ScryptoValueKind::I16 => ValueKind::I16, - ScryptoValueKind::I32 => ValueKind::I32, - ScryptoValueKind::I64 => ValueKind::I64, - ScryptoValueKind::I128 => ValueKind::I128, - - ScryptoValueKind::String => ValueKind::String, - - ScryptoValueKind::Enum => ValueKind::Enum, - ScryptoValueKind::Map => ValueKind::Map, - ScryptoValueKind::Array => ValueKind::Array, - ScryptoValueKind::Tuple => ValueKind::Tuple, - - ScryptoValueKind::Custom(custom_value_kind) => match custom_value_kind { - ScryptoCustomValueKind::PackageAddress => ValueKind::PackageAddress, - ScryptoCustomValueKind::ComponentAddress => ValueKind::ComponentAddress, - ScryptoCustomValueKind::ResourceAddress => ValueKind::ResourceAddress, - - ScryptoCustomValueKind::Bucket => ValueKind::Bucket, - ScryptoCustomValueKind::Proof => ValueKind::Proof, - - ScryptoCustomValueKind::Expression => ValueKind::Expression, - ScryptoCustomValueKind::Blob => ValueKind::Blob, - - ScryptoCustomValueKind::Hash => ValueKind::Hash, - ScryptoCustomValueKind::EcdsaSecp256k1PublicKey => { - ValueKind::EcdsaSecp256k1PublicKey - } - ScryptoCustomValueKind::EcdsaSecp256k1Signature => { - ValueKind::EcdsaSecp256k1Signature - } - ScryptoCustomValueKind::EddsaEd25519PublicKey => ValueKind::EddsaEd25519PublicKey, - ScryptoCustomValueKind::EddsaEd25519Signature => ValueKind::EddsaEd25519Signature, - - ScryptoCustomValueKind::Decimal => ValueKind::Decimal, - ScryptoCustomValueKind::PreciseDecimal => ValueKind::PreciseDecimal, - - ScryptoCustomValueKind::NonFungibleLocalId => ValueKind::NonFungibleLocalId, - ScryptoCustomValueKind::Own => ValueKind::Own, - }, - } - } -} - -impl From for ScryptoValueKind { - fn from(value: ValueKind) -> Self { - match value { - ValueKind::Bool => ScryptoValueKind::Bool, - - ValueKind::U8 => ScryptoValueKind::U8, - ValueKind::U16 => ScryptoValueKind::U16, - ValueKind::U32 => ScryptoValueKind::U32, - ValueKind::U64 => ScryptoValueKind::U64, - ValueKind::U128 => ScryptoValueKind::U128, - - ValueKind::I8 => ScryptoValueKind::I8, - ValueKind::I16 => ScryptoValueKind::I16, - ValueKind::I32 => ScryptoValueKind::I32, - ValueKind::I64 => ScryptoValueKind::I64, - ValueKind::I128 => ScryptoValueKind::I128, - - ValueKind::String => ScryptoValueKind::String, - - ValueKind::Enum => ScryptoValueKind::Enum, - - ValueKind::Some => ScryptoValueKind::Enum, - ValueKind::None => ScryptoValueKind::Enum, - ValueKind::Ok => ScryptoValueKind::Enum, - ValueKind::Err => ScryptoValueKind::Enum, - - ValueKind::Map => ScryptoValueKind::Map, - ValueKind::Array => ScryptoValueKind::Array, - ValueKind::Bytes => ScryptoValueKind::Array, - ValueKind::Tuple => ScryptoValueKind::Tuple, - - ValueKind::PackageAddress => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::PackageAddress) - } - ValueKind::ResourceAddress => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::ResourceAddress) - } - ValueKind::ComponentAddress => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::ComponentAddress) - } - - ValueKind::Proof => ScryptoValueKind::Custom(ScryptoCustomValueKind::Proof), - ValueKind::Bucket => ScryptoValueKind::Custom(ScryptoCustomValueKind::Bucket), - - ValueKind::Expression => ScryptoValueKind::Custom(ScryptoCustomValueKind::Expression), - ValueKind::Blob => ScryptoValueKind::Custom(ScryptoCustomValueKind::Blob), - ValueKind::NonFungibleGlobalId => ScryptoValueKind::Tuple, - - ValueKind::Hash => ScryptoValueKind::Custom(ScryptoCustomValueKind::Hash), - ValueKind::EcdsaSecp256k1PublicKey => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::EcdsaSecp256k1PublicKey) - } - ValueKind::EcdsaSecp256k1Signature => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::EcdsaSecp256k1Signature) - } - ValueKind::EddsaEd25519PublicKey => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::EddsaEd25519PublicKey) - } - ValueKind::EddsaEd25519Signature => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::EddsaEd25519Signature) - } - ValueKind::Decimal => ScryptoValueKind::Custom(ScryptoCustomValueKind::Decimal), - ValueKind::PreciseDecimal => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::PreciseDecimal) - } - ValueKind::NonFungibleLocalId => { - ScryptoValueKind::Custom(ScryptoCustomValueKind::NonFungibleLocalId) - } - ValueKind::Own => ScryptoValueKind::Custom(ScryptoCustomValueKind::Own), - } - } -} - -// ============ -// Conversions -// ============ - -macro_rules! value_invertible { - ($variant_name: ident, $underlying_type: ident, $field: ident) => { - // Doesn't actually need to be a TryFrom, could be a From. It's only TryFrom to work with - // serde_with - impl TryFrom<$underlying_type> for Value { - type Error = $crate::error::Error; - - fn try_from($field: $underlying_type) -> $crate::error::Result { - Ok(Value::$variant_name { $field }) - } - } - - impl TryFrom for $underlying_type { - type Error = $crate::error::Error; - - fn try_from(val: Value) -> $crate::error::Result { - match val { - Value::$variant_name { $field } => Ok($field), - _ => Err($crate::error::Error::InvalidKind { - expected: vec![ValueKind::$variant_name], - found: val.kind(), - }), - } - } - } - }; -} - -value_invertible! {U8, u8, value} -value_invertible! {U32, u32, value} -value_invertible! {Own, Own, value} -value_invertible! {String, String, value} -value_invertible! {Decimal, Decimal, value} -value_invertible! {Proof, ProofId, identifier} -value_invertible! {Blob, ManifestBlobRef, hash} -value_invertible! {Bucket, BucketId, identifier} -value_invertible! {NonFungibleLocalId, NonFungibleLocalId, value} -value_invertible! {NonFungibleGlobalId, NonFungibleGlobalId, address} -value_invertible! {PackageAddress, NetworkAwarePackageAddress, address} -value_invertible! {ResourceAddress, NetworkAwareResourceAddress, address} -value_invertible! {ComponentAddress, NetworkAwareComponentAddress, address} -value_invertible! {EcdsaSecp256k1PublicKey, EcdsaSecp256k1PublicKey, public_key} - -impl TryFrom for Value { - type Error = Error; - - fn try_from(value: EntityAddress) -> Result { - match value { - EntityAddress::ComponentAddress { address } => Ok(Value::ComponentAddress { address }), - EntityAddress::ResourceAddress { address } => Ok(Value::ResourceAddress { address }), - EntityAddress::PackageAddress { address } => Ok(Value::PackageAddress { address }), - } - } -} - -impl TryFrom for EntityAddress { - type Error = Error; - - fn try_from(value: Value) -> Result { - match value { - Value::ComponentAddress { address } => Ok(EntityAddress::ComponentAddress { address }), - Value::ResourceAddress { address } => Ok(EntityAddress::ResourceAddress { address }), - Value::PackageAddress { address } => Ok(EntityAddress::PackageAddress { address }), - _ => Err(Error::InvalidKind { - expected: vec![ - ValueKind::ComponentAddress, - ValueKind::ResourceAddress, - ValueKind::PackageAddress, - ], - found: value.kind(), - }), - } - } -} - -// ======== -// Helpers -// ======== - -fn map_if_value_string(parsing: ValueKind, value: &ast::Value, map: F) -> Result -where - F: FnOnce(&str) -> Result, -{ - if let ast::Value::String(value) = value { - map(value) - } else { - Err(Error::UnexpectedAstContents { - parsing, - expected: vec![ValueKind::String], - found: value.value_kind().into(), - }) - } -} diff --git a/radix-engine-toolkit/src/model/value/ast/bridge.rs b/radix-engine-toolkit/src/model/value/ast/bridge.rs new file mode 100644 index 00000000..6b50252c --- /dev/null +++ b/radix-engine-toolkit/src/model/value/ast/bridge.rs @@ -0,0 +1,623 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use super::model::*; +use crate::error::{Error, Result}; +use crate::model::address::*; +use crate::model::engine_identifier::TransientIdentifier; + +use native_transaction::manifest::ast; +use native_transaction::manifest::generator::GeneratorError; +use scrypto::prelude::{ + ManifestBlobRef, ManifestCustomValueKind, ManifestExpression, ManifestValueKind, +}; + +impl From for ManifestAstValueKind { + fn from(value: ast::Type) -> ManifestAstValueKind { + match value { + ast::Type::Bool => Self::Bool, + + ast::Type::I8 => Self::I8, + ast::Type::I16 => Self::I16, + ast::Type::I32 => Self::I32, + ast::Type::I64 => Self::I64, + ast::Type::I128 => Self::I128, + ast::Type::U8 => Self::U8, + ast::Type::U16 => Self::U16, + ast::Type::U32 => Self::U32, + ast::Type::U64 => Self::U64, + ast::Type::U128 => Self::U128, + + ast::Type::String => Self::String, + + ast::Type::Enum => Self::Enum, + + ast::Type::Array => Self::Array, + ast::Type::Tuple => Self::Tuple, + + ast::Type::Decimal => Self::Decimal, + ast::Type::PreciseDecimal => Self::PreciseDecimal, + + ast::Type::Address => Self::Address, + ast::Type::PackageAddress => Self::Address, + ast::Type::ResourceAddress => Self::Address, + ast::Type::ComponentAddress => Self::Address, + + ast::Type::Bucket => Self::Bucket, + ast::Type::Proof => Self::Proof, + + ast::Type::NonFungibleLocalId => Self::NonFungibleLocalId, + ast::Type::NonFungibleGlobalId => Self::NonFungibleGlobalId, + + ast::Type::Blob => Self::Blob, + ast::Type::Expression => Self::Expression, + ast::Type::Bytes => Self::Bytes, + } + } +} + +impl From for ast::Type { + fn from(value: ManifestAstValueKind) -> ast::Type { + match value { + ManifestAstValueKind::Bool => Self::Bool, + ManifestAstValueKind::I8 => Self::I8, + ManifestAstValueKind::I16 => Self::I16, + ManifestAstValueKind::I32 => Self::I32, + ManifestAstValueKind::I64 => Self::I64, + ManifestAstValueKind::I128 => Self::I128, + + ManifestAstValueKind::U8 => Self::U8, + ManifestAstValueKind::U16 => Self::U16, + ManifestAstValueKind::U32 => Self::U32, + ManifestAstValueKind::U64 => Self::U64, + ManifestAstValueKind::U128 => Self::U128, + + ManifestAstValueKind::String => Self::String, + + ManifestAstValueKind::Enum => Self::Enum, + ManifestAstValueKind::Some => Self::Enum, + ManifestAstValueKind::None => Self::Enum, + ManifestAstValueKind::Ok => Self::Enum, + ManifestAstValueKind::Err => Self::Enum, + + ManifestAstValueKind::Map => Self::Array, + ManifestAstValueKind::Array => Self::Array, + ManifestAstValueKind::Tuple => Self::Tuple, + + ManifestAstValueKind::Decimal => Self::Decimal, + ManifestAstValueKind::PreciseDecimal => Self::PreciseDecimal, + + ManifestAstValueKind::Address => Self::Address, + + ManifestAstValueKind::Bucket => Self::Bucket, + ManifestAstValueKind::Proof => Self::Proof, + + ManifestAstValueKind::NonFungibleLocalId => Self::NonFungibleLocalId, + ManifestAstValueKind::NonFungibleGlobalId => Self::NonFungibleGlobalId, + + ManifestAstValueKind::Blob => Self::Blob, + ManifestAstValueKind::Bytes => Self::Bytes, + ManifestAstValueKind::Expression => Self::Expression, + } + } +} + +impl From for ManifestAstValueKind { + fn from(value: ManifestValueKind) -> ManifestAstValueKind { + match value { + ManifestValueKind::Bool => Self::Bool, + + ManifestValueKind::I8 => Self::I8, + ManifestValueKind::I16 => Self::I16, + ManifestValueKind::I32 => Self::I32, + ManifestValueKind::I64 => Self::I64, + ManifestValueKind::I128 => Self::I128, + ManifestValueKind::U8 => Self::U8, + ManifestValueKind::U16 => Self::U16, + ManifestValueKind::U32 => Self::U32, + ManifestValueKind::U64 => Self::U64, + ManifestValueKind::U128 => Self::U128, + + ManifestValueKind::String => Self::String, + + ManifestValueKind::Enum => Self::Enum, + + ManifestValueKind::Map => Self::Map, + ManifestValueKind::Array => Self::Array, + ManifestValueKind::Tuple => Self::Tuple, + + ManifestValueKind::Custom(ManifestCustomValueKind::Decimal) => Self::Decimal, + ManifestValueKind::Custom(ManifestCustomValueKind::PreciseDecimal) => { + Self::PreciseDecimal + } + + ManifestValueKind::Custom(ManifestCustomValueKind::Address) => Self::Address, + + ManifestValueKind::Custom(ManifestCustomValueKind::Bucket) => Self::Bucket, + ManifestValueKind::Custom(ManifestCustomValueKind::Proof) => Self::Proof, + + ManifestValueKind::Custom(ManifestCustomValueKind::NonFungibleLocalId) => { + Self::NonFungibleLocalId + } + + ManifestValueKind::Custom(ManifestCustomValueKind::Blob) => Self::Blob, + ManifestValueKind::Custom(ManifestCustomValueKind::Expression) => Self::Expression, + } + } +} + +impl From for ManifestValueKind { + fn from(value: ManifestAstValueKind) -> ManifestValueKind { + match value { + ManifestAstValueKind::Bool => Self::Bool, + + ManifestAstValueKind::I8 => Self::I8, + ManifestAstValueKind::I16 => Self::I16, + ManifestAstValueKind::I32 => Self::I32, + ManifestAstValueKind::I64 => Self::I64, + ManifestAstValueKind::I128 => Self::I128, + ManifestAstValueKind::U8 => Self::U8, + ManifestAstValueKind::U16 => Self::U16, + ManifestAstValueKind::U32 => Self::U32, + ManifestAstValueKind::U64 => Self::U64, + ManifestAstValueKind::U128 => Self::U128, + + ManifestAstValueKind::String => Self::String, + + ManifestAstValueKind::Ok + | ManifestAstValueKind::Err + | ManifestAstValueKind::Some + | ManifestAstValueKind::None + | ManifestAstValueKind::Enum => Self::Enum, + + ManifestAstValueKind::Map => Self::Map, + ManifestAstValueKind::Bytes | ManifestAstValueKind::Array => Self::Array, + ManifestAstValueKind::NonFungibleGlobalId | ManifestAstValueKind::Tuple => Self::Tuple, + + ManifestAstValueKind::Decimal => Self::Custom(ManifestCustomValueKind::Decimal), + ManifestAstValueKind::PreciseDecimal => { + Self::Custom(ManifestCustomValueKind::PreciseDecimal) + } + + ManifestAstValueKind::Address => Self::Custom(ManifestCustomValueKind::Address), + + ManifestAstValueKind::Bucket => Self::Custom(ManifestCustomValueKind::Bucket), + ManifestAstValueKind::Proof => Self::Custom(ManifestCustomValueKind::Proof), + + ManifestAstValueKind::NonFungibleLocalId => { + Self::Custom(ManifestCustomValueKind::NonFungibleLocalId) + } + + ManifestAstValueKind::Blob => Self::Custom(ManifestCustomValueKind::Blob), + ManifestAstValueKind::Expression => Self::Custom(ManifestCustomValueKind::Expression), + } + } +} + +impl ManifestAstValue { + pub fn to_ast_value(&self, bech32_coder: &Bech32Coder) -> Result { + let value = match self { + ManifestAstValue::Bool { value } => ast::Value::Bool(*value), + + ManifestAstValue::I8 { value } => ast::Value::I8(*value), + ManifestAstValue::I16 { value } => ast::Value::I16(*value), + ManifestAstValue::I32 { value } => ast::Value::I32(*value), + ManifestAstValue::I64 { value } => ast::Value::I64(*value), + ManifestAstValue::I128 { value } => ast::Value::I128(*value), + + ManifestAstValue::U8 { value } => ast::Value::U8(*value), + ManifestAstValue::U16 { value } => ast::Value::U16(*value), + ManifestAstValue::U32 { value } => ast::Value::U32(*value), + ManifestAstValue::U64 { value } => ast::Value::U64(*value), + ManifestAstValue::U128 { value } => ast::Value::U128(*value), + + ManifestAstValue::String { value } => ast::Value::String(value.clone()), + + ManifestAstValue::Enum { variant, fields } => ast::Value::Enum( + variant.resolve_discriminator()?, + fields + .clone() + .unwrap_or_default() + .iter() + .map(|value| value.to_ast_value(bech32_coder)) + .collect::>>()?, + ), + ManifestAstValue::Some { value } => { + ast::Value::Some(Box::new(value.to_ast_value(bech32_coder)?)) + } + ManifestAstValue::None => ast::Value::None, + ManifestAstValue::Ok { value } => { + ast::Value::Ok(Box::new(value.to_ast_value(bech32_coder)?)) + } + ManifestAstValue::Err { value } => { + ast::Value::Err(Box::new(value.to_ast_value(bech32_coder)?)) + } + + ManifestAstValue::Array { + element_kind, + elements, + } => ast::Value::Array( + (*element_kind).into(), + elements + .iter() + .map(|id| id.to_ast_value(bech32_coder)) + .collect::>>()?, + ), + ManifestAstValue::Map { + key_value_kind, + value_value_kind, + entries, + } => ast::Value::Map( + (*key_value_kind).into(), + (*value_value_kind).into(), + entries + .iter() + .flat_map(|(x, y)| [x, y]) + .map(|value| value.to_ast_value(bech32_coder)) + .collect::>>()?, + ), + ManifestAstValue::Tuple { elements } => ast::Value::Tuple( + elements + .iter() + .map(|v| v.to_ast_value(bech32_coder)) + .collect::>>()?, + ), + + ManifestAstValue::Decimal { value } => { + ast::Value::Decimal(Box::new(ast::Value::String(value.to_string()))) + } + ManifestAstValue::PreciseDecimal { value } => { + ast::Value::PreciseDecimal(Box::new(ast::Value::String(value.to_string()))) + } + + ManifestAstValue::Address { address: value } => ast::Value::Address(Box::new( + ast::Value::String(value.to_string_with_encoder(bech32_coder)), + )), + + ManifestAstValue::Bucket { identifier } => { + ast::Value::Bucket(Box::new(match identifier.0 { + TransientIdentifier::String { + value: ref identifier, + } => ast::Value::String(identifier.clone()), + TransientIdentifier::U32 { value: identifier } => ast::Value::U32(identifier), + })) + } + ManifestAstValue::Proof { identifier } => { + ast::Value::Proof(Box::new(match identifier.0 { + TransientIdentifier::String { + value: ref identifier, + } => ast::Value::String(identifier.clone()), + TransientIdentifier::U32 { value: identifier } => ast::Value::U32(identifier), + })) + } + + ManifestAstValue::NonFungibleLocalId { value } => { + ast::Value::NonFungibleLocalId(Box::new(ast::Value::String(value.to_string()))) + } + ManifestAstValue::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { address, .. }, + non_fungible_local_id, + } => { + let nf_global_id_string = format!( + "{}:{}", + bech32_coder.encode_resource_address(address), + non_fungible_local_id + ); + ast::Value::NonFungibleGlobalId(Box::new(ast::Value::String(nf_global_id_string))) + } + + ManifestAstValue::Blob { hash } => { + ast::Value::Blob(Box::new(ast::Value::String(hex::encode(hash.0)))) + } + ManifestAstValue::Expression { value } => { + ast::Value::Expression(Box::new(ast::Value::String(match value { + ManifestExpression::EntireWorktop => "ENTIRE_WORKTOP".into(), + ManifestExpression::EntireAuthZone => "ENTIRE_AUTH_ZONE".into(), + }))) + } + ManifestAstValue::Bytes { value } => { + ast::Value::Bytes(Box::new(ast::Value::String(hex::encode(value)))) + } + }; + Ok(value) + } + + /// Converts Scrypto's tx compiler's [`ast::Value`] to a [`Value`] given a bech32 coder as + /// context. + pub fn from_ast_value(value: &ast::Value, bech32_coder: &Bech32Coder) -> Result { + let parsing = ManifestAstValueKind::from(value.value_kind()); + let value = match value { + ast::Value::Bool(value) => Self::Bool { value: *value }, + + ast::Value::I8(value) => Self::I8 { value: *value }, + ast::Value::I16(value) => Self::I16 { value: *value }, + ast::Value::I32(value) => Self::I32 { value: *value }, + ast::Value::I64(value) => Self::I64 { value: *value }, + ast::Value::I128(value) => Self::I128 { value: *value }, + + ast::Value::U8(value) => Self::U8 { value: *value }, + ast::Value::U16(value) => Self::U16 { value: *value }, + ast::Value::U32(value) => Self::U32 { value: *value }, + ast::Value::U64(value) => Self::U64 { value: *value }, + ast::Value::U128(value) => Self::U128 { value: *value }, + + ast::Value::String(value) => Self::String { + value: value.clone(), + }, + + ast::Value::Enum(variant, fields) => Self::Enum { + variant: EnumDiscriminator::U8 { + discriminator: *variant, + }, + fields: { + if fields.is_empty() { + None + } else { + Some( + fields + .iter() + .map(|value| Self::from_ast_value(value, bech32_coder)) + .collect::>>()?, + ) + } + }, + }, + + ast::Value::Some(value) => Self::Some { + value: Box::new(Self::from_ast_value(value, bech32_coder)?), + }, + ast::Value::None => Self::None, + ast::Value::Ok(value) => Self::Ok { + value: Box::new(Self::from_ast_value(value, bech32_coder)?), + }, + ast::Value::Err(value) => Self::Err { + value: Box::new(Self::from_ast_value(value, bech32_coder)?), + }, + + ast::Value::Map(key_value_kind, value_value_kind, entries) => Self::Map { + key_value_kind: (*key_value_kind).into(), + value_value_kind: (*value_value_kind).into(), + entries: { + // Ensure that we have enough elements for the window operation + if entries.len() % 2 != 0 { + Err(Error::from(GeneratorError::OddNumberOfElements)) + } else { + let mut entries_vec = Vec::new(); + for chunk in entries.chunks(2) { + let key = Self::from_ast_value(&chunk[0], bech32_coder)?; + let value = Self::from_ast_value(&chunk[1], bech32_coder)?; + + entries_vec.push((key, value)); + } + Ok(entries_vec) + } + }?, + }, + ast::Value::Array(ast_type, elements) => Self::Array { + element_kind: (*ast_type).into(), + elements: elements + .iter() + .map(|value| Self::from_ast_value(value, bech32_coder)) + .collect::>>()?, + }, + ast::Value::Tuple(elements) => Self::Tuple { + elements: elements + .iter() + .map(|value| Self::from_ast_value(value, bech32_coder)) + .collect::>>()?, + }, + ast::Value::Decimal(value) => map_if_value_string(parsing, value, |string| { + string + .parse() + .map(|value| Self::Decimal { value }) + .map_err(Error::from) + })?, + ast::Value::PreciseDecimal(value) => map_if_value_string(parsing, value, |string| { + string + .parse() + .map(|value| Self::PreciseDecimal { value }) + .map_err(Error::from) + })?, + ast::Value::Address(address) => { + map_if_value_string(parsing, address, |address_string| { + EntityAddress::from_str_with_coder(address_string, bech32_coder) + .map(|address| ManifestAstValue::Address { address }) + })? + } + + ast::Value::Bucket(value) => { + if let ast::Value::U32(identifier) = &**value { + Self::Bucket { + identifier: TransientIdentifier::U32 { value: *identifier }.into(), + } + } else if let ast::Value::String(identifier) = &**value { + Self::Bucket { + identifier: TransientIdentifier::String { + value: identifier.to_owned(), + } + .into(), + } + } else { + Err(Error::UnexpectedAstContents { + parsing: ManifestAstValueKind::Bucket, + expected: vec![ManifestAstValueKind::U32, ManifestAstValueKind::String], + found: value.value_kind().into(), + })? + } + } + ast::Value::Proof(value) => { + if let ast::Value::U32(identifier) = &**value { + Self::Proof { + identifier: TransientIdentifier::U32 { value: *identifier }.into(), + } + } else if let ast::Value::String(identifier) = &**value { + Self::Proof { + identifier: TransientIdentifier::String { + value: identifier.clone(), + } + .into(), + } + } else { + Err(Error::UnexpectedAstContents { + parsing: ManifestAstValueKind::Proof, + expected: vec![ManifestAstValueKind::U32, ManifestAstValueKind::String], + found: value.value_kind().into(), + })? + } + } + + ast::Value::NonFungibleLocalId(value) => Self::NonFungibleLocalId { + value: match &**value { + ast::Value::String(value) => value.parse()?, + _ => Err(Error::UnexpectedAstContents { + parsing: ManifestAstValueKind::NonFungibleLocalId, + expected: vec![ManifestAstValueKind::String], + found: value.value_kind().into(), + })?, + }, + }, + ast::Value::NonFungibleGlobalId(value) => match &**value { + ast::Value::String(string) => { + let native_global_id = + scrypto::prelude::NonFungibleGlobalId::try_from_canonical_string( + bech32_coder.decoder(), + string, + )?; + Self::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { + network_id: bech32_coder.network_id(), + address: native_global_id.resource_address(), + }, + non_fungible_local_id: native_global_id.local_id().clone(), + } + } + _ => Err(Error::UnexpectedAstContents { + parsing: ManifestAstValueKind::NonFungibleGlobalId, + expected: vec![ManifestAstValueKind::String], + found: value.value_kind().into(), + })?, + }, + + ast::Value::Blob(value) => map_if_value_string(parsing, value, |blob_string| { + let bytes = hex::decode(blob_string)?; + ManifestBlobRef::try_from(bytes.as_slice()) + .map(|manifest_blob| Self::Blob { + hash: manifest_blob, + }) + .map_err(Error::from) + })?, + ast::Value::Expression(value) => map_if_value_string( + parsing, + value, + |expression_string| match expression_string { + "ENTIRE_WORKTOP" => Ok(Self::Expression { + value: ManifestExpression::EntireWorktop, + }), + "ENTIRE_AUTH_ZONE" => Ok(Self::Expression { + value: ManifestExpression::EntireAuthZone, + }), + string => Err(Error::InvalidExpressionString { + found: string.to_owned(), + excepted: vec![ + String::from("ENTIRE_WORKTOP"), + String::from("ENTIRE_AUTH_ZONE"), + ], + }), + }, + )?, + + ast::Value::Bytes(value) => map_if_value_string(parsing, value, |string| { + hex::decode(string) + .map_err(Error::from) + .map(|value| Self::Bytes { value }) + })?, + }; + Ok(value) + } +} + +fn map_if_value_string( + parsing: ManifestAstValueKind, + value: &ast::Value, + map: F, +) -> Result +where + F: FnOnce(&str) -> Result, +{ + if let ast::Value::String(value) = value { + map(value) + } else { + Err(Error::UnexpectedAstContents { + parsing, + expected: vec![ManifestAstValueKind::String], + found: value.value_kind().into(), + }) + } +} + +impl TryFrom for ManifestAstValue { + type Error = Error; + + fn try_from(address: NetworkAwareResourceAddress) -> std::result::Result { + Ok(Self::Address { + address: EntityAddress::ResourceAddress { address }, + }) + } +} + +impl TryFrom for NetworkAwareResourceAddress { + type Error = Error; + + fn try_from(value: ManifestAstValue) -> std::result::Result { + if let ManifestAstValue::Address { + address: EntityAddress::ResourceAddress { address }, + } = value + { + Ok(address) + } else { + Err(Error::InvalidKind { + expected: vec![ManifestAstValueKind::Address], + found: value.kind(), + }) + } + } +} + +impl TryFrom for ManifestAstValue { + type Error = Error; + + fn try_from( + value: scrypto::prelude::NonFungibleLocalId, + ) -> std::result::Result { + Ok(Self::NonFungibleLocalId { value }) + } +} + +impl TryFrom for scrypto::prelude::NonFungibleLocalId { + type Error = Error; + + fn try_from(value: ManifestAstValue) -> std::result::Result { + if let ManifestAstValue::NonFungibleLocalId { value } = value { + Ok(value) + } else { + Err(Error::InvalidKind { + expected: vec![ManifestAstValueKind::NonFungibleLocalId], + found: value.kind(), + }) + } + } +} diff --git a/radix-engine-toolkit/src/model/value/ast/mod.rs b/radix-engine-toolkit/src/model/value/ast/mod.rs new file mode 100644 index 00000000..d592a121 --- /dev/null +++ b/radix-engine-toolkit/src/model/value/ast/mod.rs @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod bridge; +pub mod model; + +pub use bridge::*; +pub use model::*; diff --git a/radix-engine-toolkit/src/model/value/ast/model.rs b/radix-engine-toolkit/src/model/value/ast/model.rs new file mode 100644 index 00000000..e28aebba --- /dev/null +++ b/radix-engine-toolkit/src/model/value/ast/model.rs @@ -0,0 +1,359 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::define_kind_enum; +use crate::error::{Error, Result}; +use crate::model::address::{EntityAddress, NetworkAwareResourceAddress}; +use crate::model::engine_identifier::{BucketId, ProofId}; + +use native_transaction::manifest::KNOWN_ENUM_DISCRIMINATORS; +use scrypto::prelude::{ + Decimal, ManifestBlobRef, ManifestExpression, NonFungibleLocalId, PreciseDecimal, +}; +use serde_with::serde_as; +use toolkit_derive::serializable; + +define_kind_enum! { + /// A value model used to describe an algebraic sum type which is used to express transaction + /// manifests as an abstract syntax tree. This is serialized as a discriminated union of types. + #[serializable] + #[serde(tag = "type")] + #[schemars(example = "crate::example::value::ast_value::value")] + #[derive(Hash, Eq, PartialEq)] + pub enum ManifestAstValue { + /// A boolean value which can either be true or false + #[schemars( + example = "crate::example::value::ast_value::bool1", + example = "crate::example::value::ast_value::bool2" + )] + Bool { value: bool }, + + /// An 8-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::u8")] + U8 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u8, + }, + + /// A 16-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::u16")] + U16 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u16, + }, + + /// A 32-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::u32")] + U32 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u32, + }, + + /// A 64-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::u64")] + U64 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u64, + }, + + /// A 128-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::u128")] + U128 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u128, + }, + + /// An 8-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::i8")] + I8 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i8, + }, + + /// A 16-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::i16")] + I16 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i16, + }, + + /// A 32-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::i32")] + I32 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i32, + }, + + /// A 64-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::i64")] + I64 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i64, + }, + + /// A 128-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::ast_value::i128")] + I128 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i128, + }, + + /// A type representing a string + #[schemars(example = "crate::example::value::ast_value::string")] + String { value: String }, + + /// A Rust-style Enum which has a variant and can optionally also have a list of values + /// (acting in a way similar to discriminated algebraic sum types) + #[schemars( + example = "crate::example::value::ast_value::enum1", + example = "crate::example::value::ast_value::enum2", + example = "crate::example::value::ast_value::enum3", + example = "crate::example::value::ast_value::enum4" + )] + Enum { + /// The enum discriminator which is either a string or an unsigned 8-bit integer. + variant: EnumDiscriminator, + + /// Optional fields that the enum may have + #[serde(default, skip_serializing_if = "Option::is_none")] + fields: Option>, + }, + + /// The `Some` case of Rust Options where the value is some Self + #[schemars(example = "crate::example::value::ast_value::some")] + Some { value: Box }, + + /// The `None` case of Rust Options where there is value + #[schemars(example = "crate::example::value::ast_value::none")] + None, + + /// The `Ok` case of Rust Results where the value is some Self + #[schemars(example = "crate::example::value::ast_value::ok")] + Ok { value: Box }, + + /// The `Err` case of Rust Results where the value is some Self + #[schemars(example = "crate::example::value::ast_value::err")] + Err { value: Box }, + + /// An array values of a single value kind + #[schemars(example = "crate::example::value::ast_value::array")] + Array { + /// The kind of elements that the array contains. An array will be validated to ensure + /// that it contains a single element kind. + element_kind: ManifestAstValueKind, + + /// The elements of the array which may contain 0 or more elements. + elements: Vec, + }, + + /// A key-value map of values where all keys are of a single kind and all values are of a + /// single kind + #[schemars(example = "crate::example::value::ast_value::map")] + Map { + /// The kind of the keys used for the map. A map will be validated to ensure that its keys + /// are all of a single kind. + key_value_kind: ManifestAstValueKind, + + /// The kind of the values used for the map. A map will be validated to ensure that its + /// values are all of a single kind. + value_value_kind: ManifestAstValueKind, + + /// A vector of tuples representing the entires in the map where each tuple is made up of + /// two elements: a key and a value. + entries: Vec<(Self, Self)>, + }, + + /// An array of elements where elements could be of different kinds. + #[schemars(example = "crate::example::value::ast_value::tuple")] + Tuple { elements: Vec }, + + /// A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum + /// of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and + /// -57896044618658097711785492504343953926634992332820282019728.792003956564819968 + /// respectively + #[schemars(example = "crate::example::value::ast_value::decimal")] + Decimal { + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: Decimal, + }, + + /// A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and + /// minimum of + /// 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. + /// 9083451713845015929093243025426876941405973284973216824503042047 + /// and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 + /// respectively + #[schemars(example = "crate::example::value::ast_value::precise_decimal")] + PreciseDecimal { + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: PreciseDecimal, + }, + + /// Represents a Bech32m encoded human-readable address which may be used to address a package, + /// component, or resource. This address is serialized as a human-readable bech32m encoded + /// string. + #[schemars( + example = "crate::example::value::ast_value::address1", + example = "crate::example::value::ast_value::address2", + example = "crate::example::value::ast_value::address3" + )] + Address { + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + address: EntityAddress, + }, + + /// Represents a Scrypto bucket which is identified through a transient identifier which is + /// either a string or an unsigned 32-bit integer which is serialized as a Integer. + #[schemars( + example = "crate::example::value::ast_value::bucket1", + example = "crate::example::value::ast_value::bucket2", + )] + Bucket { identifier: BucketId }, + + /// Represents a Scrypto proof which is identified through a transient identifier which is + /// either a string or an unsigned 32-bit integer which is serialized as a Integer. + #[schemars( + example = "crate::example::value::ast_value::proof1", + example = "crate::example::value::ast_value::proof2", + )] + Proof { identifier: ProofId }, + + /// Represents non-fungible ids which is a discriminated union of the different types that + /// non-fungible ids may be. + #[schemars( + example = "crate::example::value::ast_value::non_fungible_local_id1", + example = "crate::example::value::ast_value::non_fungible_local_id2", + example = "crate::example::value::ast_value::non_fungible_local_id3", + example = "crate::example::value::ast_value::non_fungible_local_id4", + )] + NonFungibleLocalId { + #[schemars(with = "crate::model::address::NonFungibleLocalId")] + #[serde_as(as = "serde_with::TryFromInto")] + value: NonFungibleLocalId, + }, + + /// Represents a non-fungible address which may be considered as the "global" address of a + /// non-fungible unit as it contains both the resource address and the non-fungible id for that + /// unit. + #[schemars( + example = "crate::example::value::ast_value::non_fungible_global_id1", + example = "crate::example::value::ast_value::non_fungible_global_id2", + example = "crate::example::value::ast_value::non_fungible_global_id3", + example = "crate::example::value::ast_value::non_fungible_global_id4", + )] + NonFungibleGlobalId { + #[schemars(with = "ManifestAstValue")] + #[serde_as(as = "serde_with::TryFromInto")] + resource_address: NetworkAwareResourceAddress, + + #[schemars(with = "ManifestAstValue")] + #[serde_as(as = "serde_with::TryFromInto")] + non_fungible_local_id: NonFungibleLocalId, + }, + + /// Represents a transaction manifest expression. + #[schemars( + example = "crate::example::value::ast_value::expression1", + example = "crate::example::value::ast_value::expression2", + )] + Expression { + #[schemars(with = "crate::model::runtime::Expression")] + #[serde_as(as = "serde_with::FromInto")] + value: ManifestExpression, + }, + + /// Represents the hash of a blob provided as part of a transaction manifest. This is + /// represented as a byte array of 32 bytes which is serialized as a hex string. + #[schemars(example = "crate::example::value::ast_value::blob")] + Blob { + #[schemars(with = "crate::model::runtime::Blob")] + #[serde_as(as = "serde_with::FromInto")] + hash: ManifestBlobRef, + }, + + /// Represents a byte array of an unknown size which is serialized as a hex string + #[schemars(example = "crate::example::value::ast_value::bytes")] + Bytes { + #[serde_as(as = "serde_with::hex::Hex")] + #[schemars(with = "String")] + value: Vec, + }, + } +} + +/// A union of the types of discriminators that enums may have. This may either be a string or an +/// 8-bit unsigned number. +#[serializable] +#[serde(tag = "type")] +#[derive(Hash, Eq, PartialEq, PartialOrd, Ord)] +#[schemars( + example = "crate::example::value::ast_value::enum_discriminator1", + example = "crate::example::value::ast_value::enum_discriminator2" +)] +pub enum EnumDiscriminator { + String { + /// A string discriminator of the fully qualified well-known enum name + discriminator: String, + }, + U8 { + /// An 8-bit unsigned integer serialized as a string. + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + discriminator: u8, + }, +} + +impl EnumDiscriminator { + /// Resolves the enum discriminator to a [`u8`] discriminator. + pub fn resolve_discriminator(&self) -> Result { + match self { + Self::U8 { discriminator } => Ok(*discriminator), + Self::String { discriminator } => KNOWN_ENUM_DISCRIMINATORS + .get(discriminator.as_str()) + .copied() + .ok_or(Error::InvalidEnumDiscriminator { + discriminator: discriminator.clone(), + }), + } + } +} diff --git a/radix-engine-toolkit/src/model/value/macros.rs b/radix-engine-toolkit/src/model/value/macros.rs new file mode 100644 index 00000000..1687a987 --- /dev/null +++ b/radix-engine-toolkit/src/model/value/macros.rs @@ -0,0 +1,71 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#[macro_export] +macro_rules! define_kind_enum { + ( + $(#[$enum_metadata:meta])* + $vis:vis enum $enum_ident:ident { + $( + $(#[$variant_metadata:meta])* + $variant_ident:ident $( + { + $( + $(#[$field_metadata:meta])* + $field_ident:ident : $field_type:ty + ),* $(,)? + } + )? + ),* $(,)? + } + ) => + { + paste::item! { + $(#[$enum_metadata])* + $vis enum $enum_ident { + $( + $(#[$variant_metadata])* + $variant_ident $({ + $( + $(#[$field_metadata])* + $field_ident: $field_type + ),* + })? + ),* + } + + #[toolkit_derive::serializable] + #[derive(Hash, Eq, PartialEq, Copy)] + $vis enum [< $enum_ident Kind >] { + $( + $(#[$variant_metadata])* + $variant_ident + ),* + } + + impl $enum_ident { + pub fn kind(&self) -> [< $enum_ident Kind >] { + match self { + $( + Self::$variant_ident {..} => [< $enum_ident Kind >]::$variant_ident + ),* + } + } + } + } + }; +} diff --git a/radix-engine-toolkit/src/model/value/manifest_sbor/bridge.rs b/radix-engine-toolkit/src/model/value/manifest_sbor/bridge.rs new file mode 100644 index 00000000..a050dd62 --- /dev/null +++ b/radix-engine-toolkit/src/model/value/manifest_sbor/bridge.rs @@ -0,0 +1,423 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use super::model::*; +use crate::error::Result; +use crate::model::address::{ + EntityAddress, NetworkAwareComponentAddress, NetworkAwarePackageAddress, + NetworkAwareResourceAddress, +}; +use crate::utils::checked_copy_u8_slice; + +use scrypto::prelude::{ + BytesNonFungibleLocalId, ComponentAddress, Decimal, IntegerNonFungibleLocalId, + ManifestCustomValue, ManifestCustomValueKind, ManifestValue, ManifestValueKind, + NonFungibleLocalId, PackageAddress, PreciseDecimal, ResourceAddress, StringNonFungibleLocalId, + UUIDNonFungibleLocalId, +}; +use scrypto::prelude::{ + ManifestAddress, ManifestBlobRef, ManifestBucket, ManifestDecimal, ManifestNonFungibleLocalId, + ManifestPreciseDecimal, ManifestProof, +}; + +impl From for ManifestSborValueKind { + fn from(value: ManifestValueKind) -> Self { + match value { + ManifestValueKind::Bool => ManifestSborValueKind::Bool, + + ManifestValueKind::U8 => ManifestSborValueKind::U8, + ManifestValueKind::U16 => ManifestSborValueKind::U16, + ManifestValueKind::U32 => ManifestSborValueKind::U32, + ManifestValueKind::U64 => ManifestSborValueKind::U64, + ManifestValueKind::U128 => ManifestSborValueKind::U128, + + ManifestValueKind::I8 => ManifestSborValueKind::I8, + ManifestValueKind::I16 => ManifestSborValueKind::I16, + ManifestValueKind::I32 => ManifestSborValueKind::I32, + ManifestValueKind::I64 => ManifestSborValueKind::I64, + ManifestValueKind::I128 => ManifestSborValueKind::I128, + + ManifestValueKind::String => ManifestSborValueKind::String, + + ManifestValueKind::Enum => ManifestSborValueKind::Enum, + ManifestValueKind::Map => ManifestSborValueKind::Map, + ManifestValueKind::Array => ManifestSborValueKind::Array, + ManifestValueKind::Tuple => ManifestSborValueKind::Tuple, + + ManifestValueKind::Custom(ManifestCustomValueKind::Address) => { + ManifestSborValueKind::Address + } + + ManifestValueKind::Custom(ManifestCustomValueKind::Decimal) => { + ManifestSborValueKind::Decimal + } + ManifestValueKind::Custom(ManifestCustomValueKind::PreciseDecimal) => { + ManifestSborValueKind::PreciseDecimal + } + ManifestValueKind::Custom(ManifestCustomValueKind::NonFungibleLocalId) => { + ManifestSborValueKind::NonFungibleLocalId + } + + ManifestValueKind::Custom(ManifestCustomValueKind::Bucket) => { + ManifestSborValueKind::Bucket + } + ManifestValueKind::Custom(ManifestCustomValueKind::Proof) => { + ManifestSborValueKind::Proof + } + + ManifestValueKind::Custom(ManifestCustomValueKind::Blob) => ManifestSborValueKind::Blob, + ManifestValueKind::Custom(ManifestCustomValueKind::Expression) => { + ManifestSborValueKind::Expression + } + } + } +} + +impl From for ManifestValueKind { + fn from(value: ManifestSborValueKind) -> Self { + match value { + ManifestSborValueKind::Bool => ManifestValueKind::Bool, + + ManifestSborValueKind::U8 => ManifestValueKind::U8, + ManifestSborValueKind::U16 => ManifestValueKind::U16, + ManifestSborValueKind::U32 => ManifestValueKind::U32, + ManifestSborValueKind::U64 => ManifestValueKind::U64, + ManifestSborValueKind::U128 => ManifestValueKind::U128, + + ManifestSborValueKind::I8 => ManifestValueKind::I8, + ManifestSborValueKind::I16 => ManifestValueKind::I16, + ManifestSborValueKind::I32 => ManifestValueKind::I32, + ManifestSborValueKind::I64 => ManifestValueKind::I64, + ManifestSborValueKind::I128 => ManifestValueKind::I128, + + ManifestSborValueKind::String => ManifestValueKind::String, + + ManifestSborValueKind::Enum => ManifestValueKind::Enum, + ManifestSborValueKind::Map => ManifestValueKind::Map, + ManifestSborValueKind::Array => ManifestValueKind::Array, + ManifestSborValueKind::Tuple => ManifestValueKind::Tuple, + + ManifestSborValueKind::Address => { + ManifestValueKind::Custom(ManifestCustomValueKind::Address) + } + ManifestSborValueKind::Decimal => { + ManifestValueKind::Custom(ManifestCustomValueKind::Decimal) + } + ManifestSborValueKind::PreciseDecimal => { + ManifestValueKind::Custom(ManifestCustomValueKind::PreciseDecimal) + } + ManifestSborValueKind::NonFungibleLocalId => { + ManifestValueKind::Custom(ManifestCustomValueKind::NonFungibleLocalId) + } + ManifestSborValueKind::Bucket => { + ManifestValueKind::Custom(ManifestCustomValueKind::Bucket) + } + ManifestSborValueKind::Proof => { + ManifestValueKind::Custom(ManifestCustomValueKind::Proof) + } + + ManifestSborValueKind::Blob => ManifestValueKind::Custom(ManifestCustomValueKind::Blob), + ManifestSborValueKind::Expression => { + ManifestValueKind::Custom(ManifestCustomValueKind::Expression) + } + } + } +} + +impl ManifestSborValue { + pub fn to_manifest_sbor_value(&self) -> Result { + let value = match self { + Self::Bool { value } => ManifestValue::Bool { value: *value }, + + Self::U8 { value } => ManifestValue::U8 { value: *value }, + Self::U16 { value } => ManifestValue::U16 { value: *value }, + Self::U32 { value } => ManifestValue::U32 { value: *value }, + Self::U64 { value } => ManifestValue::U64 { value: *value }, + Self::U128 { value } => ManifestValue::U128 { value: *value }, + + Self::I8 { value } => ManifestValue::I8 { value: *value }, + Self::I16 { value } => ManifestValue::I16 { value: *value }, + Self::I32 { value } => ManifestValue::I32 { value: *value }, + Self::I64 { value } => ManifestValue::I64 { value: *value }, + Self::I128 { value } => ManifestValue::I128 { value: *value }, + + Self::String { value } => ManifestValue::String { + value: value.clone(), + }, + Self::Enum { variant, fields } => ManifestValue::Enum { + discriminator: *variant, + fields: fields + .clone() + .unwrap_or_default() + .into_iter() + .map(|value| value.to_manifest_sbor_value()) + .collect::>>()?, + }, + Self::Map { + key_value_kind, + value_value_kind, + entries, + } => ManifestValue::Map { + key_value_kind: (*key_value_kind).into(), + value_value_kind: (*value_value_kind).into(), + entries: { + let mut scrypto_entries = Vec::new(); + for (key, value) in entries { + scrypto_entries.push(( + key.to_manifest_sbor_value()?, + value.to_manifest_sbor_value()?, + )) + } + scrypto_entries + }, + }, + Self::Array { + element_kind, + elements, + } => ManifestValue::Array { + element_value_kind: (*element_kind).into(), + elements: elements + .clone() + .into_iter() + .map(|value| value.to_manifest_sbor_value()) + .collect::>>()?, + }, + Self::Tuple { elements } => ManifestValue::Tuple { + fields: elements + .clone() + .into_iter() + .map(|value| value.to_manifest_sbor_value()) + .collect::>>()?, + }, + + // TODO: checked_copy_u8_slice can cause a crash if the length is not checked. MUST + // change + Self::Address { address } => ManifestValue::Custom { + value: ManifestCustomValue::Address(match address { + EntityAddress::ComponentAddress { address } => { + ManifestAddress::Component(checked_copy_u8_slice(address.address.to_vec())?) + } + EntityAddress::ResourceAddress { address } => { + ManifestAddress::Resource(checked_copy_u8_slice(address.address.to_vec())?) + } + EntityAddress::PackageAddress { address } => { + ManifestAddress::Package(checked_copy_u8_slice(address.address.to_vec())?) + } + }), + }, + + // TODO: checked_copy_u8_slice can cause a crash if the length is not checked. MUST + // change + Self::Decimal { value } => ManifestValue::Custom { + value: ManifestCustomValue::Decimal(ManifestDecimal(checked_copy_u8_slice( + value.to_vec(), + )?)), + }, + Self::PreciseDecimal { value } => ManifestValue::Custom { + value: ManifestCustomValue::PreciseDecimal(ManifestPreciseDecimal( + checked_copy_u8_slice(value.to_vec())?, + )), + }, + + Self::Bucket { identifier } => ManifestValue::Custom { + value: ManifestCustomValue::Bucket(ManifestBucket(*identifier)), + }, + Self::Proof { identifier } => ManifestValue::Custom { + value: ManifestCustomValue::Proof(ManifestProof(*identifier)), + }, + + Self::Expression { value } => ManifestValue::Custom { + value: ManifestCustomValue::Expression(*value), + }, + Self::Blob { hash } => ManifestValue::Custom { + value: ManifestCustomValue::Blob(ManifestBlobRef(hash.0)), + }, + + Self::NonFungibleLocalId { value } => ManifestValue::Custom { + value: ManifestCustomValue::NonFungibleLocalId(match value { + NonFungibleLocalId::Integer(v) => { + ManifestNonFungibleLocalId::Integer(v.value()) + } + NonFungibleLocalId::UUID(v) => ManifestNonFungibleLocalId::UUID(v.value()), + NonFungibleLocalId::String(v) => { + ManifestNonFungibleLocalId::String(v.value().to_owned()) + } + NonFungibleLocalId::Bytes(v) => { + ManifestNonFungibleLocalId::Bytes(v.value().to_owned()) + } + }), + }, + }; + Ok(value) + } + + pub fn from_manifest_sbor_value(scrypto_value: &ManifestValue, network_id: u8) -> Result { + let value = match scrypto_value { + ManifestValue::Bool { value } => Self::Bool { value: *value }, + + ManifestValue::U8 { value } => Self::U8 { value: *value }, + ManifestValue::U16 { value } => Self::U16 { value: *value }, + ManifestValue::U32 { value } => Self::U32 { value: *value }, + ManifestValue::U64 { value } => Self::U64 { value: *value }, + ManifestValue::U128 { value } => Self::U128 { value: *value }, + + ManifestValue::I8 { value } => Self::I8 { value: *value }, + ManifestValue::I16 { value } => Self::I16 { value: *value }, + ManifestValue::I32 { value } => Self::I32 { value: *value }, + ManifestValue::I64 { value } => Self::I64 { value: *value }, + ManifestValue::I128 { value } => Self::I128 { value: *value }, + + ManifestValue::String { value } => Self::String { + value: value.clone(), + }, + + ManifestValue::Enum { + discriminator, + fields, + } => Self::Enum { + variant: *discriminator, + fields: if fields.is_empty() { + None + } else { + Some( + fields + .clone() + .into_iter() + .map(|value| Self::from_manifest_sbor_value(&value, network_id)) + .collect::>>()?, + ) + }, + }, + ManifestValue::Map { + key_value_kind, + value_value_kind, + entries, + } => Self::Map { + key_value_kind: (*key_value_kind).into(), + value_value_kind: (*value_value_kind).into(), + entries: { + let mut scrypto_entries = Vec::new(); + for (key, value) in entries { + scrypto_entries.push(( + Self::from_manifest_sbor_value(key, network_id)?, + Self::from_manifest_sbor_value(value, network_id)?, + )) + } + scrypto_entries + }, + }, + ManifestValue::Array { + element_value_kind, + elements, + } => Self::Array { + element_kind: (*element_value_kind).into(), + elements: elements + .clone() + .into_iter() + .map(|value| Self::from_manifest_sbor_value(&value, network_id)) + .collect::>>()?, + }, + ManifestValue::Tuple { fields } => Self::Tuple { + elements: fields + .clone() + .into_iter() + .map(|value| Self::from_manifest_sbor_value(&value, network_id)) + .collect::>>()?, + }, + + ManifestValue::Custom { + value: ManifestCustomValue::Address(value), + } => match value { + ManifestAddress::Component(address) => Self::Address { + address: EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id, + address: ComponentAddress::try_from(address.as_slice())?, + }, + }, + }, + ManifestAddress::Resource(address) => Self::Address { + address: EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id, + address: ResourceAddress::try_from(address.as_slice())?, + }, + }, + }, + ManifestAddress::Package(address) => Self::Address { + address: EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id, + address: PackageAddress::try_from(address.as_slice())?, + }, + }, + }, + }, + + ManifestValue::Custom { + value: ManifestCustomValue::Bucket(bucket), + } => Self::Bucket { + identifier: bucket.0, + }, + ManifestValue::Custom { + value: ManifestCustomValue::Proof(proof), + } => Self::Proof { + identifier: proof.0, + }, + + ManifestValue::Custom { + value: ManifestCustomValue::Blob(blob), + } => Self::Blob { + hash: ManifestBlobRef(blob.0), + }, + ManifestValue::Custom { + value: ManifestCustomValue::Expression(expression), + } => Self::Expression { value: *expression }, + + ManifestValue::Custom { + value: ManifestCustomValue::Decimal(value), + } => Self::Decimal { + value: Decimal::try_from(value.0.as_slice())?, + }, + ManifestValue::Custom { + value: ManifestCustomValue::PreciseDecimal(value), + } => Self::PreciseDecimal { + value: PreciseDecimal::try_from(value.0.as_slice())?, + }, + + ManifestValue::Custom { + value: ManifestCustomValue::NonFungibleLocalId(value), + } => Self::NonFungibleLocalId { + value: match value { + ManifestNonFungibleLocalId::Integer(v) => { + NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(*v)) + } + ManifestNonFungibleLocalId::UUID(v) => { + NonFungibleLocalId::UUID(UUIDNonFungibleLocalId::new(*v)?) + } + ManifestNonFungibleLocalId::String(v) => { + NonFungibleLocalId::String(StringNonFungibleLocalId::new(v.to_owned())?) + } + ManifestNonFungibleLocalId::Bytes(v) => { + NonFungibleLocalId::Bytes(BytesNonFungibleLocalId::new(v.to_owned())?) + } + }, + }, + }; + Ok(value) + } +} diff --git a/radix-engine-toolkit/src/model/value/manifest_sbor/mod.rs b/radix-engine-toolkit/src/model/value/manifest_sbor/mod.rs new file mode 100644 index 00000000..d592a121 --- /dev/null +++ b/radix-engine-toolkit/src/model/value/manifest_sbor/mod.rs @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod bridge; +pub mod model; + +pub use bridge::*; +pub use model::*; diff --git a/radix-engine-toolkit/src/model/value/manifest_sbor/model.rs b/radix-engine-toolkit/src/model/value/manifest_sbor/model.rs new file mode 100644 index 00000000..6a8fcab1 --- /dev/null +++ b/radix-engine-toolkit/src/model/value/manifest_sbor/model.rs @@ -0,0 +1,279 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::define_kind_enum; +use crate::model::address::EntityAddress; + +use scrypto::prelude::{ + Decimal, ManifestBlobRef, ManifestExpression, NonFungibleLocalId, PreciseDecimal, +}; +use serde_with::serde_as; +use toolkit_derive::serializable; + +define_kind_enum! { + /// A value model used to describe an algebraic sum type which is used to express Manifest SBOR + /// values. This is serialized as a discriminated union of types. + #[serializable] + #[serde(tag = "type")] + #[derive(Hash, Eq, PartialEq)] + pub enum ManifestSborValue { + /// A boolean value which can either be true or false + #[schemars( + example = "crate::example::value::manifest_sbor_value::bool1", + example = "crate::example::value::manifest_sbor_value::bool2", + )] + Bool { value: bool }, + + /// An 8-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::u8")] + U8 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u8, + }, + + /// A 16-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::u16")] + U16 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u16, + }, + + /// A 32-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::u32")] + U32 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u32, + }, + + /// A 64-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::u64")] + U64 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u64, + }, + + /// A 128-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::u128")] + U128 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u128, + }, + + /// An 8-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::i8")] + I8 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i8, + }, + + /// A 16-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::i16")] + I16 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i16, + }, + + /// A 32-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::i32")] + I32 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i32, + }, + + /// A 64-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::i64")] + I64 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i64, + }, + + /// A 128-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::manifest_sbor_value::i128")] + I128 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i128, + }, + + /// A type representing a string + #[schemars(example = "crate::example::value::manifest_sbor_value::string")] + String { value: String }, + + /// A Rust-style Enum which has a variant and can optionally also have a list of values + /// (acting in a way similar to discriminated algebraic sum types) + #[schemars( + example = "crate::example::value::manifest_sbor_value::enum1", + example = "crate::example::value::manifest_sbor_value::enum2", + )] + Enum { + /// The variant of the enum. + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + variant: u8, + + /// Optional fields that the enum may have + #[serde(default, skip_serializing_if = "Option::is_none")] + fields: Option>, + }, + + /// An array values of a single value kind + #[schemars(example = "crate::example::value::manifest_sbor_value::array")] + Array { + /// The kind of elements that the array contains. An array will be validated to ensure + /// that it contains a single element kind. + element_kind: ManifestSborValueKind, + + /// The elements of the array which may contain 0 or more elements. + elements: Vec, + }, + + /// A key-value map of values where all keys are of a single kind and all values are of a + /// single kind + #[schemars(example = "crate::example::value::manifest_sbor_value::map")] + Map { + /// The kind of the keys used for the map. A map will be validated to ensure that its keys + /// are all of a single kind. + key_value_kind: ManifestSborValueKind, + + /// The kind of the values used for the map. A map will be validated to ensure that its + /// values are all of a single kind. + value_value_kind: ManifestSborValueKind, + + /// A vector of tuples representing the entires in the map where each tuple is made up of + /// two elements: a key and a value. + entries: Vec<(Self, Self)>, + }, + + /// An array of elements where elements could be of different kinds. + #[schemars(example = "crate::example::value::manifest_sbor_value::tuple")] + Tuple { elements: Vec }, + + /// Represents a Bech32m encoded human-readable address which may be used to address a package, + /// component, or resource. This address is serialized as a human-readable bech32m encoded + /// string. + #[schemars( + example = "crate::example::value::manifest_sbor_value::address1", + example = "crate::example::value::manifest_sbor_value::address2", + example = "crate::example::value::manifest_sbor_value::address3" + )] + Address { + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + address: EntityAddress, + }, + + /// Represents a Scrypto bucket which is identified through a transient identifier which is + /// a 32-bit integer which is serialized as a Integer. + #[schemars(example = "crate::example::value::manifest_sbor_value::bucket")] + Bucket { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + identifier: u32 + }, + + /// Represents a Scrypto proof which is identified through a transient identifier which is + /// a 32-bit integer which is serialized as a Integer. + #[schemars(example = "crate::example::value::manifest_sbor_value::proof")] + Proof { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + identifier: u32 + }, + + /// A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum + /// of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and + /// -57896044618658097711785492504343953926634992332820282019728.792003956564819968 + /// respectively + #[schemars(example = "crate::example::value::manifest_sbor_value::decimal")] + Decimal { + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: Decimal, + }, + + /// A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and + /// minimum of + /// 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. + /// 9083451713845015929093243025426876941405973284973216824503042047 + /// and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 + /// respectively + #[schemars(example = "crate::example::value::manifest_sbor_value::precise_decimal")] + PreciseDecimal { + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: PreciseDecimal, + }, + + /// Represents non-fungible ids which is a discriminated union of the different types that + /// non-fungible ids may be. + #[schemars( + example = "crate::example::value::manifest_sbor_value::non_fungible_local_id1", + example = "crate::example::value::manifest_sbor_value::non_fungible_local_id2", + example = "crate::example::value::manifest_sbor_value::non_fungible_local_id3", + example = "crate::example::value::manifest_sbor_value::non_fungible_local_id4" + )] + NonFungibleLocalId { + #[schemars(with = "crate::model::address::NonFungibleLocalId")] + #[serde_as(as = "serde_with::TryFromInto")] + value: NonFungibleLocalId, + }, + + /// Represents a transaction manifest expression. + #[schemars( + example = "crate::example::value::manifest_sbor_value::expression1", + example = "crate::example::value::manifest_sbor_value::expression2", + )] + Expression { + #[schemars(with = "crate::model::runtime::Expression")] + #[serde_as(as = "serde_with::FromInto")] + value: ManifestExpression, + }, + + /// Represents the hash of a blob provided as part of a transaction manifest. This is + /// represented as a byte array of 32 bytes which is serialized as a hex string. + #[schemars(example = "crate::example::value::manifest_sbor_value::blob")] + Blob { + #[schemars(with = "crate::model::runtime::Blob")] + #[serde_as(as = "serde_with::FromInto")] + hash: ManifestBlobRef, + }, + } +} diff --git a/radix-engine-toolkit/src/model/value/mod.rs b/radix-engine-toolkit/src/model/value/mod.rs new file mode 100644 index 00000000..f09ebeee --- /dev/null +++ b/radix-engine-toolkit/src/model/value/mod.rs @@ -0,0 +1,21 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod ast; +pub mod macros; +pub mod manifest_sbor; +pub mod scrypto_sbor; diff --git a/radix-engine-toolkit/src/model/value/scrypto_sbor/bridge.rs b/radix-engine-toolkit/src/model/value/scrypto_sbor/bridge.rs new file mode 100644 index 00000000..eb867caa --- /dev/null +++ b/radix-engine-toolkit/src/model/value/scrypto_sbor/bridge.rs @@ -0,0 +1,330 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use super::model::*; +use crate::error::Result; +use crate::model::address::*; +use crate::model::engine_identifier::NodeIdentifier; + +use scrypto::prelude::{ + ScryptoCustomValue, ScryptoCustomValueKind, ScryptoValue, ScryptoValueKind, +}; +use scrypto::runtime::Address; + +impl From for ScryptoSborValueKind { + fn from(value: ScryptoValueKind) -> Self { + match value { + ScryptoValueKind::Bool => ScryptoSborValueKind::Bool, + + ScryptoValueKind::U8 => ScryptoSborValueKind::U8, + ScryptoValueKind::U16 => ScryptoSborValueKind::U16, + ScryptoValueKind::U32 => ScryptoSborValueKind::U32, + ScryptoValueKind::U64 => ScryptoSborValueKind::U64, + ScryptoValueKind::U128 => ScryptoSborValueKind::U128, + + ScryptoValueKind::I8 => ScryptoSborValueKind::I8, + ScryptoValueKind::I16 => ScryptoSborValueKind::I16, + ScryptoValueKind::I32 => ScryptoSborValueKind::I32, + ScryptoValueKind::I64 => ScryptoSborValueKind::I64, + ScryptoValueKind::I128 => ScryptoSborValueKind::I128, + + ScryptoValueKind::String => ScryptoSborValueKind::String, + + ScryptoValueKind::Enum => ScryptoSborValueKind::Enum, + ScryptoValueKind::Map => ScryptoSborValueKind::Map, + ScryptoValueKind::Array => ScryptoSborValueKind::Array, + ScryptoValueKind::Tuple => ScryptoSborValueKind::Tuple, + + ScryptoValueKind::Custom(ScryptoCustomValueKind::Address) => { + ScryptoSborValueKind::Address + } + + ScryptoValueKind::Custom(ScryptoCustomValueKind::Decimal) => { + ScryptoSborValueKind::Decimal + } + ScryptoValueKind::Custom(ScryptoCustomValueKind::PreciseDecimal) => { + ScryptoSborValueKind::PreciseDecimal + } + ScryptoValueKind::Custom(ScryptoCustomValueKind::NonFungibleLocalId) => { + ScryptoSborValueKind::NonFungibleLocalId + } + ScryptoValueKind::Custom(ScryptoCustomValueKind::Own) => ScryptoSborValueKind::Own, + ScryptoValueKind::Custom(ScryptoCustomValueKind::Reference) => { + ScryptoSborValueKind::Reference + } + } + } +} + +impl From for ScryptoValueKind { + fn from(value: ScryptoSborValueKind) -> Self { + match value { + ScryptoSborValueKind::Bool => ScryptoValueKind::Bool, + + ScryptoSborValueKind::U8 => ScryptoValueKind::U8, + ScryptoSborValueKind::U16 => ScryptoValueKind::U16, + ScryptoSborValueKind::U32 => ScryptoValueKind::U32, + ScryptoSborValueKind::U64 => ScryptoValueKind::U64, + ScryptoSborValueKind::U128 => ScryptoValueKind::U128, + + ScryptoSborValueKind::I8 => ScryptoValueKind::I8, + ScryptoSborValueKind::I16 => ScryptoValueKind::I16, + ScryptoSborValueKind::I32 => ScryptoValueKind::I32, + ScryptoSborValueKind::I64 => ScryptoValueKind::I64, + ScryptoSborValueKind::I128 => ScryptoValueKind::I128, + + ScryptoSborValueKind::String => ScryptoValueKind::String, + + ScryptoSborValueKind::Enum => ScryptoValueKind::Enum, + ScryptoSborValueKind::Map => ScryptoValueKind::Map, + ScryptoSborValueKind::Array => ScryptoValueKind::Array, + ScryptoSborValueKind::Tuple => ScryptoValueKind::Tuple, + + ScryptoSborValueKind::Address => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::Address) + } + ScryptoSborValueKind::Decimal => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::Decimal) + } + ScryptoSborValueKind::PreciseDecimal => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::PreciseDecimal) + } + ScryptoSborValueKind::NonFungibleLocalId => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::NonFungibleLocalId) + } + ScryptoSborValueKind::Own => ScryptoValueKind::Custom(ScryptoCustomValueKind::Own), + ScryptoSborValueKind::Reference => { + ScryptoValueKind::Custom(ScryptoCustomValueKind::Reference) + } + } + } +} + +impl ScryptoSborValue { + pub fn to_scrypto_sbor_value(&self) -> Result { + let value = match self { + Self::Bool { value } => ScryptoValue::Bool { value: *value }, + + Self::U8 { value } => ScryptoValue::U8 { value: *value }, + Self::U16 { value } => ScryptoValue::U16 { value: *value }, + Self::U32 { value } => ScryptoValue::U32 { value: *value }, + Self::U64 { value } => ScryptoValue::U64 { value: *value }, + Self::U128 { value } => ScryptoValue::U128 { value: *value }, + + Self::I8 { value } => ScryptoValue::I8 { value: *value }, + Self::I16 { value } => ScryptoValue::I16 { value: *value }, + Self::I32 { value } => ScryptoValue::I32 { value: *value }, + Self::I64 { value } => ScryptoValue::I64 { value: *value }, + Self::I128 { value } => ScryptoValue::I128 { value: *value }, + + Self::String { value } => ScryptoValue::String { + value: value.clone(), + }, + Self::Enum { variant, fields } => ScryptoValue::Enum { + discriminator: *variant, + fields: fields + .clone() + .unwrap_or_default() + .into_iter() + .map(|value| value.to_scrypto_sbor_value()) + .collect::>>()?, + }, + Self::Map { + key_value_kind, + value_value_kind, + entries, + } => ScryptoValue::Map { + key_value_kind: (*key_value_kind).into(), + value_value_kind: (*value_value_kind).into(), + entries: { + let mut scrypto_entries = Vec::new(); + for (key, value) in entries { + scrypto_entries + .push((key.to_scrypto_sbor_value()?, value.to_scrypto_sbor_value()?)) + } + scrypto_entries + }, + }, + Self::Array { + element_kind, + elements, + } => ScryptoValue::Array { + element_value_kind: (*element_kind).into(), + elements: elements + .clone() + .into_iter() + .map(|value| value.to_scrypto_sbor_value()) + .collect::>>()?, + }, + Self::Tuple { elements } => ScryptoValue::Tuple { + fields: elements + .clone() + .into_iter() + .map(|value| value.to_scrypto_sbor_value()) + .collect::>>()?, + }, + + Self::Address { address } => ScryptoValue::Custom { + value: ScryptoCustomValue::Address(address.clone().into()), + }, + + Self::Decimal { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::Decimal(*value), + }, + Self::PreciseDecimal { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::PreciseDecimal(*value), + }, + + Self::NonFungibleLocalId { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::NonFungibleLocalId(value.clone()), + }, + + Self::Own { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::Own(*value), + }, + Self::Reference { value } => ScryptoValue::Custom { + value: ScryptoCustomValue::InternalRef( + radix_engine_common::data::scrypto::model::InternalRef(value.0), + ), + }, + }; + Ok(value) + } + + pub fn from_scrypto_sbor_value(scrypto_value: &ScryptoValue, network_id: u8) -> Self { + match scrypto_value { + ScryptoValue::Bool { value } => Self::Bool { value: *value }, + + ScryptoValue::U8 { value } => Self::U8 { value: *value }, + ScryptoValue::U16 { value } => Self::U16 { value: *value }, + ScryptoValue::U32 { value } => Self::U32 { value: *value }, + ScryptoValue::U64 { value } => Self::U64 { value: *value }, + ScryptoValue::U128 { value } => Self::U128 { value: *value }, + + ScryptoValue::I8 { value } => Self::I8 { value: *value }, + ScryptoValue::I16 { value } => Self::I16 { value: *value }, + ScryptoValue::I32 { value } => Self::I32 { value: *value }, + ScryptoValue::I64 { value } => Self::I64 { value: *value }, + ScryptoValue::I128 { value } => Self::I128 { value: *value }, + + ScryptoValue::String { value } => Self::String { + value: value.clone(), + }, + + ScryptoValue::Enum { + discriminator, + fields, + } => Self::Enum { + variant: *discriminator, + fields: if fields.is_empty() { + None + } else { + Some( + fields + .clone() + .into_iter() + .map(|value| Self::from_scrypto_sbor_value(&value, network_id)) + .collect(), + ) + }, + }, + ScryptoValue::Map { + key_value_kind, + value_value_kind, + entries, + } => Self::Map { + key_value_kind: (*key_value_kind).into(), + value_value_kind: (*value_value_kind).into(), + entries: { + let mut scrypto_entries = Vec::new(); + for (key, value) in entries { + scrypto_entries.push(( + Self::from_scrypto_sbor_value(key, network_id), + Self::from_scrypto_sbor_value(value, network_id), + )) + } + scrypto_entries + }, + }, + ScryptoValue::Array { + element_value_kind, + elements, + } => Self::Array { + element_kind: (*element_value_kind).into(), + elements: elements + .clone() + .into_iter() + .map(|value| Self::from_scrypto_sbor_value(&value, network_id)) + .collect(), + }, + ScryptoValue::Tuple { fields } => Self::Tuple { + elements: fields + .clone() + .into_iter() + .map(|value| Self::from_scrypto_sbor_value(&value, network_id)) + .collect(), + }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::Address(value), + } => Self::Address { + address: match value { + Address::Component(address) => EntityAddress::ComponentAddress { + address: NetworkAwareComponentAddress { + network_id, + address: *address, + }, + }, + Address::Resource(address) => EntityAddress::ResourceAddress { + address: NetworkAwareResourceAddress { + network_id, + address: *address, + }, + }, + Address::Package(address) => EntityAddress::PackageAddress { + address: NetworkAwarePackageAddress { + network_id, + address: *address, + }, + }, + }, + }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::Decimal(value), + } => Self::Decimal { value: *value }, + ScryptoValue::Custom { + value: ScryptoCustomValue::PreciseDecimal(value), + } => Self::PreciseDecimal { value: *value }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::NonFungibleLocalId(value), + } => Self::NonFungibleLocalId { + value: value.clone(), + }, + + ScryptoValue::Custom { + value: ScryptoCustomValue::Own(value), + } => Self::Own { value: *value }, + ScryptoValue::Custom { + value: ScryptoCustomValue::InternalRef(value), + } => Self::Reference { + value: NodeIdentifier(value.0), + }, + } + } +} diff --git a/radix-engine-toolkit/src/model/value/scrypto_sbor/mod.rs b/radix-engine-toolkit/src/model/value/scrypto_sbor/mod.rs new file mode 100644 index 00000000..d592a121 --- /dev/null +++ b/radix-engine-toolkit/src/model/value/scrypto_sbor/mod.rs @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +pub mod bridge; +pub mod model; + +pub use bridge::*; +pub use model::*; diff --git a/radix-engine-toolkit/src/model/value/scrypto_sbor/model.rs b/radix-engine-toolkit/src/model/value/scrypto_sbor/model.rs new file mode 100644 index 00000000..ada4a36e --- /dev/null +++ b/radix-engine-toolkit/src/model/value/scrypto_sbor/model.rs @@ -0,0 +1,259 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::define_kind_enum; +use crate::model::address::EntityAddress; +use crate::model::engine_identifier::NodeIdentifier; + +use scrypto::prelude::{Decimal, NonFungibleLocalId, PreciseDecimal}; +use scrypto::runtime::Own; +use serde_with::serde_as; +use toolkit_derive::serializable; + +define_kind_enum! { + /// A value model used to describe an algebraic sum type which is used to express Scrypto SBOR + /// values. This is serialized as a discriminated union of types. + #[serializable] + #[serde(tag = "type")] + #[derive(Hash, Eq, PartialEq)] + pub enum ScryptoSborValue { + /// A boolean value which can either be true or false + #[schemars( + example = "crate::example::value::scrypto_sbor_value::bool1", + example = "crate::example::value::scrypto_sbor_value::bool2" + )] + Bool { value: bool }, + + /// An 8-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::u8")] + U8 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u8, + }, + + /// A 16-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::u16")] + U16 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u16, + }, + + /// A 32-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::u32")] + U32 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u32, + }, + + /// A 64-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::u64")] + U64 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u64, + }, + + /// A 128-bit unsigned integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::u128")] + U128 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: u128, + }, + + /// An 8-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::i8")] + I8 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i8, + }, + + /// A 16-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::i16")] + I16 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i16, + }, + + /// A 32-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::i32")] + I32 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i32, + }, + + /// A 64-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::i32")] + I64 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i64, + }, + + /// A 128-bit signed integer which is serialized and deserialized as a string. + #[schemars(example = "crate::example::value::scrypto_sbor_value::i128")] + I128 { + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: i128, + }, + + /// A type representing a string + #[schemars(example = "crate::example::value::scrypto_sbor_value::string")] + String { value: String }, + + /// A Rust-style Enum which has a variant and can optionally also have a list of values + /// (acting in a way similar to discriminated algebraic sum types) + #[schemars( + example = "crate::example::value::scrypto_sbor_value::enum1", + example = "crate::example::value::scrypto_sbor_value::enum2" + )] + Enum { + /// The variant of the enum. + #[schemars(regex(pattern = "[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + variant: u8, + + /// Optional fields that the enum may have + #[serde(default, skip_serializing_if = "Option::is_none")] + fields: Option>, + }, + + /// An array values of a single value kind + #[schemars(example = "crate::example::value::scrypto_sbor_value::array")] + Array { + /// The kind of elements that the array contains. An array will be validated to ensure + /// that it contains a single element kind. + element_kind: ScryptoSborValueKind, + + /// The elements of the array which may contain 0 or more elements. + elements: Vec, + }, + + /// A key-value map of values where all keys are of a single kind and all values are of a + /// single kind + #[schemars(example = "crate::example::value::scrypto_sbor_value::map")] + Map { + /// The kind of the keys used for the map. A map will be validated to ensure that its keys + /// are all of a single kind. + key_value_kind: ScryptoSborValueKind, + + /// The kind of the values used for the map. A map will be validated to ensure that its + /// values are all of a single kind. + value_value_kind: ScryptoSborValueKind, + + /// A vector of tuples representing the entires in the map where each tuple is made up of + /// two elements: a key and a value. + entries: Vec<(Self, Self)>, + }, + + /// An array of elements where elements could be of different kinds. + #[schemars(example = "crate::example::value::scrypto_sbor_value::tuple")] + Tuple { elements: Vec }, + + /// Represents a Bech32m encoded human-readable address which may be used to address a package, + /// component, or resource. This address is serialized as a human-readable bech32m encoded + /// string. + #[schemars( + example = "crate::example::value::scrypto_sbor_value::address1", + example = "crate::example::value::scrypto_sbor_value::address2", + example = "crate::example::value::scrypto_sbor_value::address3" + )] + Address { + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + address: EntityAddress, + }, + + /// Represents a tagged enum of owned Radix Engine Nodes. + #[schemars( + example = "crate::example::value::scrypto_sbor_value::own1", + example = "crate::example::value::scrypto_sbor_value::own2", + example = "crate::example::value::scrypto_sbor_value::own3", + example = "crate::example::value::scrypto_sbor_value::own4", + example = "crate::example::value::scrypto_sbor_value::own5" + )] + Own { + #[schemars(with = "crate::model::engine_identifier::Own")] + #[serde_as(as = "serde_with::FromInto")] + value: Own, + }, + + /// A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum + /// of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and + /// -57896044618658097711785492504343953926634992332820282019728.792003956564819968 + /// respectively + #[schemars(example = "crate::example::value::scrypto_sbor_value::decimal")] + Decimal { + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: Decimal, + }, + + /// A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and + /// minimum of + /// 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. + /// 9083451713845015929093243025426876941405973284973216824503042047 + /// and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 + /// respectively + #[schemars(example = "crate::example::value::scrypto_sbor_value::precise_decimal")] + PreciseDecimal { + #[schemars(regex(pattern = "[+-]?([0-9]*[.])?[0-9]+"))] + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + value: PreciseDecimal, + }, + + /// Represents non-fungible ids which is a discriminated union of the different types that + /// non-fungible ids may be. + #[schemars( + example = "crate::example::value::scrypto_sbor_value::non_fungible_local_id1", + example = "crate::example::value::scrypto_sbor_value::non_fungible_local_id2", + example = "crate::example::value::scrypto_sbor_value::non_fungible_local_id3", + example = "crate::example::value::scrypto_sbor_value::non_fungible_local_id4", + )] + NonFungibleLocalId { + #[schemars(with = "crate::model::address::NonFungibleLocalId")] + #[serde_as(as = "serde_with::TryFromInto")] + value: NonFungibleLocalId, + }, + + /// Represents a reference to some RENode. + #[schemars(example = "crate::example::value::scrypto_sbor_value::reference")] + Reference { + value: NodeIdentifier + } + } +} diff --git a/radix-engine-toolkit/src/request/analyze_manifest.rs b/radix-engine-toolkit/src/request/analyze_manifest.rs index 80298c64..a3cc01f7 100644 --- a/radix-engine-toolkit/src/request/analyze_manifest.rs +++ b/radix-engine-toolkit/src/request/analyze_manifest.rs @@ -18,15 +18,22 @@ use std::collections::BTreeSet; use crate::error::Result; -use crate::model::instruction_list::InstructionKind; -use crate::model::TransactionManifest; -use crate::{ - traverse_instruction, AccountInteractionsInstructionVisitor, AddressValueAggregator, - ConvertManifestHandler, Handler, Instruction, InstructionList, NetworkAwareComponentAddress, - NetworkAwarePackageAddress, NetworkAwareResourceAddress, ValueNetworkAggregatorVisitor, +use crate::model::address::{ + EntityAddress, NetworkAwareComponentAddress, NetworkAwarePackageAddress, + NetworkAwareResourceAddress, }; -use scrypto::prelude::ComponentAddress; -use serializable::serializable; +use crate::model::instruction::Instruction; +use crate::model::transaction::{InstructionKind, InstructionList, TransactionManifest}; +use crate::request::convert_manifest::ConvertManifestRequest; +use crate::utils::is_account; +use crate::visitor::{ + traverse_instruction, AccountInteractionsInstructionVisitor, AddressAggregatorVisitor, + ValueNetworkAggregatorVisitor, +}; +use toolkit_derive::serializable; + +use super::convert_manifest::ConvertManifestHandler; +use super::traits::Handler; // ================= // Model Definition @@ -43,7 +50,7 @@ pub struct AnalyzeManifestRequest { #[serde_as(as = "serde_with::DisplayFromStr")] pub network_id: u8, - /// The manifest to convert to the format described by `instructions_output_kind` + /// The manifest to analyze. pub manifest: TransactionManifest, } @@ -52,48 +59,48 @@ pub struct AnalyzeManifestRequest { pub struct AnalyzeManifestResponse { /// A set of all of the package addresses seen in the manifest. The underlying type of this is /// an array of `PackageAddress`es from the `Value` model. - #[schemars(with = "BTreeSet")] - #[serde_as(as = "BTreeSet>")] + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] pub package_addresses: BTreeSet, /// A set of all of the component addresses seen in the manifest. The underlying type of this /// is an array of `ComponentAddress`es from the `Value` model. - #[schemars(with = "BTreeSet")] - #[serde_as(as = "BTreeSet>")] + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] pub component_addresses: BTreeSet, /// A set of all of the resource addresses seen in the manifest. The underlying type of this is /// an array of `ResourceAddress`es from the `Value` model. - #[schemars(with = "BTreeSet")] - #[serde_as(as = "BTreeSet>")] + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] pub resource_addresses: BTreeSet, /// A set of all of the account component addresses seen in the manifest. The underlying type /// of this is an array of `ComponentAddress`es from the `Value` model. - #[schemars(with = "BTreeSet")] - #[serde_as(as = "BTreeSet>")] + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] pub account_addresses: BTreeSet, /// A set of all of the account component addresses in the manifest which had methods invoked /// on them that would typically require auth (or a signature) to be called successfully. /// This is a subset of the addresses seen in `account_addresses`. The underlying type of /// this is an array of `ComponentAddress`es from the `Value` model. - #[schemars(with = "BTreeSet")] - #[serde_as(as = "BTreeSet>")] + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] pub accounts_requiring_auth: BTreeSet, /// A set of all of the account component addresses in the manifest which were withdrawn from. /// This is a subset of the addresses seen in `account_addresses`. The underlying type of this /// is an array of `ComponentAddress`es from the `Value` model. - #[schemars(with = "BTreeSet")] - #[serde_as(as = "BTreeSet>")] + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] pub accounts_withdrawn_from: BTreeSet, /// A set of all of the account component addresses in the manifest which were deposited into. /// This is a subset of the addresses seen in `account_addresses`. The underlying type of this /// is an array of `ComponentAddress`es from the `Value` model. - #[schemars(with = "BTreeSet")] - #[serde_as(as = "BTreeSet>")] + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] pub accounts_deposited_into: BTreeSet, } @@ -128,7 +135,7 @@ impl Handler for AnalyzeManifes .iter() .find(|network_id| **network_id != request.network_id) { - return Err(crate::Error::NetworkMismatchError { + return Err(crate::error::Error::NetworkMismatchError { found: *network_id, expected: request.network_id, }); @@ -139,7 +146,7 @@ impl Handler for AnalyzeManifes fn handle(request: &AnalyzeManifestRequest) -> Result { // Getting the instructions in the passed manifest as parsed instructions let mut instructions = { - let manifest = ConvertManifestHandler::fulfill(crate::ConvertManifestRequest { + let manifest = ConvertManifestHandler::fulfill(ConvertManifestRequest { network_id: request.network_id, instructions_output_kind: InstructionKind::Parsed, manifest: request.manifest.clone(), @@ -156,7 +163,7 @@ impl Handler for AnalyzeManifes }?; // Setting up the visitors and traversing the instructions - let mut address_aggregator_visitor = AddressValueAggregator::default(); + let mut address_aggregator_visitor = AddressAggregatorVisitor::default(); let mut account_interactions_visitor = AccountInteractionsInstructionVisitor::default(); instructions .iter_mut() @@ -176,14 +183,7 @@ impl Handler for AnalyzeManifes account_addresses: address_aggregator_visitor .component_addresses .into_iter() - .filter(|address| { - matches!( - address.address, - ComponentAddress::Account(..) - | ComponentAddress::EcdsaSecp256k1VirtualAccount(..) - | ComponentAddress::EddsaEd25519VirtualAccount(..) - ) - }) + .filter(|address| is_account(address)) .collect(), accounts_requiring_auth: account_interactions_visitor.auth_required, accounts_withdrawn_from: account_interactions_visitor.accounts_withdrawn_from, diff --git a/radix-engine-toolkit/src/request/analyze_manifest_with_preview_context.rs b/radix-engine-toolkit/src/request/analyze_manifest_with_preview_context.rs new file mode 100644 index 00000000..b4717aa7 --- /dev/null +++ b/radix-engine-toolkit/src/request/analyze_manifest_with_preview_context.rs @@ -0,0 +1,391 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::collections::BTreeSet; + +use crate::error::{Error, Result}; +use crate::model::address::{EntityAddress, NetworkAwarePackageAddress}; +use crate::model::address::{NetworkAwareComponentAddress, NetworkAwareResourceAddress}; +use crate::model::instruction::Instruction; +use crate::model::transaction::{InstructionKind, InstructionList, TransactionManifest}; +use crate::visitor::{ + traverse_instruction, AccountDeposit, AccountDepositsInstructionVisitor, + AccountInteractionsInstructionVisitor, AccountProofsInstructionVisitor, AccountWithdraw, + AccountWithdrawsInstructionVisitor, AddressAggregatorVisitor, ValueNetworkAggregatorVisitor, +}; +use radix_engine::transaction::{TransactionReceipt, TransactionResult}; +use radix_engine::types::{scrypto_decode, ComponentAddress}; +use toolkit_derive::serializable; + +use super::traits::Handler; +use super::{ConvertManifestHandler, ConvertManifestRequest}; + +// ================= +// Model Definition +// ================= + +/// Analyzes the passed manifest to determine the entities that this manifest interacts with. +#[serializable] +pub struct AnalyzeManifestWithPreviewContextRequest { + /// An unsigned 8 bit integer serialized as a string which represents the ID of the network + /// that the manifest will be used on. The primary use of this is for any Bech32m encoding + /// or decoding of addresses + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub network_id: u8, + + /// The manifest to analyze. + pub manifest: TransactionManifest, + + /// The SBOR encoded transaction receipt obtained from the performing a transaction preview + /// with the given manifest. This byte array is serialized as a hex-encoded byte array. + #[schemars(with = "String")] + #[serde_as(as = "serde_with::hex::Hex")] + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + pub transaction_receipt: Vec, +} + +/// The response of the [`AnalyzeManifestWithPreviewContextRequest`] +#[serializable] +pub struct AnalyzeManifestWithPreviewContextResponse { + // TODO: Should we remove all native packages and components from this list? + /// The set of addresses encountered in the manifest. + /// + /// This field is populated through static analysis of the manifest and captures the set of all + /// addresses encountered in the manifest. This captures addresses if they're used in calls, + /// used as arguments, or contained as parts of some list or array. + pub encountered_addresses: EncounteredAddresses, + + /// A set of account component addresses which were involved in actions that require auth. + /// + /// This field is obtained through static analysis of the manifest by the Radix Engine Toolkit. + /// When the toolkit encounters an instruction being performed on an account that requires auth + /// (e.g., withdrawing funds, locking fee, creating proofs), it is added to this address set. + /// + /// It is then the job of the wallet to determine whether the account has been securified and + /// uses an access controller or is still operating in signature mode and produce the correct + /// auth based on that. + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub accounts_requiring_auth: BTreeSet, + + /// A set of the resource addresses of which proofs were created from accounts in this + /// manifest. + /// + /// This field is populated through static analysis of the manifest instruction. This field + /// captures the resource addresses of all of the proofs created from accounts throughout the + /// manifest. This field does not capture the amount of the proof created nor which account the + /// proof was created from. + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub account_proof_resources: BTreeSet, + + /// A list of the account withdraws seen in the manifest. + /// + /// This field is populated through static analysis of the manifest and it captures information + /// relating to the resources withdrawn from accounts such as the component address of the + /// account, the resource address of the withdrawn, and either an amount or set of non-fungible + /// local ids of the withdrawn resources. + pub account_withdraws: Vec, + + /// A list of the account deposits which occur in the transaction. + /// + /// This field is populated through both static analysis of the manifest and through the + /// context provided by the transaction preview. All deposits referred to as "exact" are + /// deposits which are guaranteed by the static analysis while the ones referred to as + /// "estimate" are deposits which are primarily obtained from the context of the previews + pub account_deposits: Vec, + + /// The set of entities which were newly created in this transaction. + pub created_entities: CreatedEntities, +} + +/// The set of addresses encountered in the manifest +#[serializable] +#[derive(PartialEq, PartialOrd, Eq, Ord)] +pub struct EncounteredAddresses { + /// The set of component addresses encountered in the manifest + pub component_addresses: EncounteredComponents, + + /// The set of resource addresses encountered in the manifest + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub resource_addresses: BTreeSet, + + /// The set of package addresses encountered in the manifest + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub package_addresses: BTreeSet, +} + +/// The set of newly created entities +#[serializable] +#[derive(PartialEq, PartialOrd, Eq, Ord)] +pub struct CreatedEntities { + /// The set of addresses of newly created components. + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub component_addresses: BTreeSet, + + /// The set of addresses of newly created resources. + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub resource_addresses: BTreeSet, + + /// The set of addresses of newly created packages. + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub package_addresses: BTreeSet, +} + +/// The set of addresses encountered in the manifest +#[serializable] +#[derive(PartialEq, PartialOrd, Eq, Ord)] +pub struct EncounteredComponents { + /// The set of user application components encountered in the manifest + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub user_applications: BTreeSet, + + /// The set of account components encountered in the manifest + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub accounts: BTreeSet, + + /// The set of identity components encountered in the manifest + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub identities: BTreeSet, + + /// The set of clock components encountered in the manifest + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub clocks: BTreeSet, + + /// The set of epoch_manager components encountered in the manifest + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub epoch_managers: BTreeSet, + + /// The set of validator components encountered in the manifest + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub validators: BTreeSet, + + /// The set of validator components encountered in the manifest + #[schemars(with = "BTreeSet")] + #[serde_as(as = "BTreeSet>")] + pub access_controller: BTreeSet, +} + +impl From> for EncounteredComponents { + fn from(value: BTreeSet) -> Self { + let mut user_applications = BTreeSet::new(); + let mut accounts = BTreeSet::new(); + let mut identities = BTreeSet::new(); + let mut clocks = BTreeSet::new(); + let mut epoch_managers = BTreeSet::new(); + let mut validators = BTreeSet::new(); + let mut access_controller = BTreeSet::new(); + + for address in value { + let underlying_address = address.address; + match underlying_address { + ComponentAddress::Normal(..) => user_applications.insert(address), + ComponentAddress::Account(..) + | ComponentAddress::EcdsaSecp256k1VirtualAccount(..) + | ComponentAddress::EddsaEd25519VirtualAccount(..) => accounts.insert(address), + ComponentAddress::Identity(..) + | ComponentAddress::EcdsaSecp256k1VirtualIdentity(..) + | ComponentAddress::EddsaEd25519VirtualIdentity(..) => identities.insert(address), + ComponentAddress::Clock(..) => clocks.insert(address), + ComponentAddress::EpochManager(..) => epoch_managers.insert(address), + ComponentAddress::Validator(..) => validators.insert(address), + ComponentAddress::AccessController(..) => access_controller.insert(address), + }; + } + + Self { + user_applications, + accounts, + identities, + clocks, + epoch_managers, + validators, + access_controller, + } + } +} + +// =============== +// Implementation +// =============== + +pub struct AnalyzeManifestWithPreviewContextHandler; + +impl Handler + for AnalyzeManifestWithPreviewContextHandler +{ + fn pre_process( + mut request: AnalyzeManifestWithPreviewContextRequest, + ) -> Result { + // Visitors + let mut network_aggregator_visitor = ValueNetworkAggregatorVisitor::default(); + + // Instructions + let instructions: &mut [Instruction] = match request.manifest.instructions { + InstructionList::Parsed(ref mut instructions) => instructions, + InstructionList::String(..) => &mut [], + }; + + // Traverse instructions with visitors + instructions + .iter_mut() + .map(|instruction| { + traverse_instruction(instruction, &mut [&mut network_aggregator_visitor], &mut []) + }) + .collect::>>()?; + + // Check for network mismatches + if let Some(network_id) = network_aggregator_visitor + .0 + .iter() + .find(|network_id| **network_id != request.network_id) + { + return Err(crate::error::Error::NetworkMismatchError { + found: *network_id, + expected: request.network_id, + }); + } + Ok(request) + } + + fn handle( + request: &AnalyzeManifestWithPreviewContextRequest, + ) -> Result { + // Getting the instructions in the passed manifest as Parsed instructions. + let mut instructions = { + let manifest = ConvertManifestHandler::fulfill(ConvertManifestRequest { + network_id: request.network_id, + instructions_output_kind: InstructionKind::Parsed, + manifest: request.manifest.clone(), + })? + .manifest; + + match manifest.instructions { + InstructionList::Parsed(instructions) => Ok(instructions), + InstructionList::String(..) => Err(crate::error::Error::Infallible { + message: "Impossible Case! We converted to parsed but it's still a string!" + .into(), + }), + } + }?; + + let receipt = scrypto_decode::(&request.transaction_receipt)?; + let commit = match receipt.result { + TransactionResult::Commit(commit) => Ok(commit), + _ => Err(Error::TransactionNotCommitted), + }?; + + // Setting up the visitors that will be used on the instructions + let mut account_interactions_visitor = AccountInteractionsInstructionVisitor::default(); + let mut account_withdraws_visitor = AccountWithdrawsInstructionVisitor::default(); + let mut account_proofs_visitor = AccountProofsInstructionVisitor::default(); + let mut address_aggregator_visitor = AddressAggregatorVisitor::default(); + let mut account_deposits_visitor = { + let resource_changes = receipt + .execution_trace + .resource_changes + .clone() + .into_iter() + .map(|(k, v)| (k as u32, v)) + .collect(); + let worktop_changes = receipt + .execution_trace + .worktop_changes() + .into_iter() + .map(|(k, v)| (k as u32, v)) + .collect(); + AccountDepositsInstructionVisitor::new( + request.network_id, + resource_changes, + worktop_changes, + ) + }; + instructions + .iter_mut() + .map(|instruction| { + traverse_instruction( + instruction, + &mut [&mut address_aggregator_visitor], + &mut [ + &mut account_interactions_visitor, + &mut account_withdraws_visitor, + &mut account_deposits_visitor, + &mut account_proofs_visitor, + ], + ) + }) + .collect::>>()?; + + Ok(AnalyzeManifestWithPreviewContextResponse { + accounts_requiring_auth: account_interactions_visitor.auth_required, + account_proof_resources: account_proofs_visitor.created_proofs, + encountered_addresses: EncounteredAddresses { + component_addresses: address_aggregator_visitor.component_addresses.into(), + resource_addresses: address_aggregator_visitor.resource_addresses, + package_addresses: address_aggregator_visitor.package_addresses, + }, + account_withdraws: account_withdraws_visitor.0, + account_deposits: account_deposits_visitor.deposits, + created_entities: CreatedEntities { + component_addresses: commit + .new_component_addresses() + .iter() + .map(|address| NetworkAwareComponentAddress { + address: *address, + network_id: request.network_id, + }) + .collect(), + resource_addresses: commit + .new_resource_addresses() + .iter() + .map(|address| NetworkAwareResourceAddress { + address: *address, + network_id: request.network_id, + }) + .collect(), + package_addresses: commit + .new_package_addresses() + .iter() + .map(|address| NetworkAwarePackageAddress { + address: *address, + network_id: request.network_id, + }) + .collect(), + }, + }) + } + + fn post_process( + _: &AnalyzeManifestWithPreviewContextRequest, + response: AnalyzeManifestWithPreviewContextResponse, + ) -> Result { + Ok(response) + } +} diff --git a/radix-engine-toolkit/src/request/compile_notarized_transaction.rs b/radix-engine-toolkit/src/request/compile_notarized_transaction.rs index d06c89f2..83fcb7f2 100644 --- a/radix-engine-toolkit/src/request/compile_notarized_transaction.rs +++ b/radix-engine-toolkit/src/request/compile_notarized_transaction.rs @@ -15,12 +15,13 @@ // specific language governing permissions and limitations // under the License. +use super::traits::Handler; use crate::error::Result; -use crate::model::transaction::NotarizedTransaction; -use crate::request::Handler; +use crate::model::instruction::Instruction; +use crate::model::transaction::{InstructionList, NotarizedTransaction}; use crate::traits::CompilableIntent; -use crate::{traverse_instruction, Instruction, InstructionList, ValueNetworkAggregatorVisitor}; -use serializable::serializable; +use crate::visitor::{traverse_instruction, ValueNetworkAggregatorVisitor}; +use toolkit_derive::serializable; // ================= // Model Definition @@ -94,7 +95,7 @@ impl Handler .iter() .find(|network_id| **network_id != expected_network_id) { - return Err(crate::Error::NetworkMismatchError { + return Err(crate::error::Error::NetworkMismatchError { found: *network_id, expected: expected_network_id, }); diff --git a/radix-engine-toolkit/src/request/convert_manifest.rs b/radix-engine-toolkit/src/request/convert_manifest.rs index 3452033d..74b2527e 100644 --- a/radix-engine-toolkit/src/request/convert_manifest.rs +++ b/radix-engine-toolkit/src/request/convert_manifest.rs @@ -15,15 +15,13 @@ // specific language governing permissions and limitations // under the License. +use super::traits::Handler; use crate::error::Result; use crate::model::address::Bech32Coder; -use crate::model::instruction_list::InstructionKind; -use crate::model::TransactionManifest; -use crate::{ - traverse_instruction, Handler, Instruction, InstructionList, ValueAliasingVisitor, - ValueNetworkAggregatorVisitor, -}; -use serializable::serializable; +use crate::model::instruction::Instruction; +use crate::model::transaction::{InstructionKind, InstructionList, TransactionManifest}; +use crate::visitor::{traverse_instruction, ValueAliasingVisitor, ValueNetworkAggregatorVisitor}; +use toolkit_derive::serializable; // ================= // Model Definition @@ -103,7 +101,7 @@ impl Handler for ConvertManifes .iter() .find(|network_id| **network_id != request.network_id) { - return Err(crate::Error::NetworkMismatchError { + return Err(crate::error::Error::NetworkMismatchError { found: *network_id, expected: request.network_id, }); diff --git a/radix-engine-toolkit/src/request/decode_address.rs b/radix-engine-toolkit/src/request/decode_address.rs index d64c4e1f..53f0838c 100644 --- a/radix-engine-toolkit/src/request/decode_address.rs +++ b/radix-engine-toolkit/src/request/decode_address.rs @@ -15,13 +15,14 @@ // specific language governing permissions and limitations // under the License. +use super::traits::Handler; use crate::error::Result; use crate::model::address::{EntityAddress, EntityType}; -use crate::request::Handler; use crate::utils::network_definition_from_network_id; +use toolkit_derive::serializable; + use bech32::{self, FromBase32, Variant}; -use scrypto::radix_engine_interface::address::AddressError; -use serializable::serializable; +use scrypto::address::AddressError; // ================= // Model Definition diff --git a/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs b/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs index d044b7bb..bbb8cf48 100644 --- a/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs +++ b/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs @@ -15,14 +15,13 @@ // specific language governing permissions and limitations // under the License. +use super::traits::Handler; use crate::error::Result; -use crate::model::transaction::NotarizedTransaction; -use crate::request::Handler; +use crate::model::instruction::Instruction; +use crate::model::transaction::{InstructionKind, InstructionList, NotarizedTransaction}; use crate::traits::CompilableIntent; -use crate::{ - traverse_instruction, Instruction, InstructionKind, InstructionList, ValueAliasingVisitor, -}; -use serializable::serializable; +use crate::visitor::{traverse_instruction, ValueAliasingVisitor}; +use toolkit_derive::serializable; // ================= // Model Definition diff --git a/radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs b/radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs index ee4c119a..e415ff3a 100644 --- a/radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs +++ b/radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs @@ -15,14 +15,13 @@ // specific language governing permissions and limitations // under the License. +use super::traits::Handler; use crate::error::Result; -use crate::model::transaction::SignedTransactionIntent; -use crate::request::Handler; +use crate::model::instruction::Instruction; +use crate::model::transaction::{InstructionKind, InstructionList, SignedTransactionIntent}; use crate::traits::CompilableIntent; -use crate::{ - traverse_instruction, Instruction, InstructionKind, InstructionList, ValueAliasingVisitor, -}; -use serializable::serializable; +use crate::visitor::{traverse_instruction, ValueAliasingVisitor}; +use toolkit_derive::serializable; // ================= // Model Definition diff --git a/radix-engine-toolkit/src/request/decompile_transaction_intent.rs b/radix-engine-toolkit/src/request/decompile_transaction_intent.rs index ef405628..3c6b8394 100644 --- a/radix-engine-toolkit/src/request/decompile_transaction_intent.rs +++ b/radix-engine-toolkit/src/request/decompile_transaction_intent.rs @@ -15,14 +15,13 @@ // specific language governing permissions and limitations // under the License. +use super::traits::Handler; use crate::error::Result; -use crate::model::transaction::TransactionIntent; -use crate::request::Handler; +use crate::model::instruction::Instruction; +use crate::model::transaction::{InstructionKind, InstructionList, TransactionIntent}; use crate::traits::CompilableIntent; -use crate::{ - traverse_instruction, Instruction, InstructionKind, InstructionList, ValueAliasingVisitor, -}; -use serializable::serializable; +use crate::visitor::{traverse_instruction, ValueAliasingVisitor}; +use toolkit_derive::serializable; // ================= // Model Definition diff --git a/radix-engine-toolkit/src/request/decompile_unknown_intent.rs b/radix-engine-toolkit/src/request/decompile_unknown_intent.rs index 5b293565..2c26900a 100644 --- a/radix-engine-toolkit/src/request/decompile_unknown_intent.rs +++ b/radix-engine-toolkit/src/request/decompile_unknown_intent.rs @@ -15,20 +15,30 @@ // specific language governing permissions and limitations // under the License. -use crate::error::Result; -use crate::request::Handler; -use crate::request::{ - DecompileNotarizedTransactionRequest, DecompileNotarizedTransactionResponse, - DecompileSignedTransactionIntentRequest, DecompileSignedTransactionIntentResponse, - DecompileTransactionIntentRequest, DecompileTransactionIntentResponse, +use super::decompile_notarized_transaction::{ + DecompileNotarizedTransactionHandler, DecompileNotarizedTransactionRequest, + DecompileNotarizedTransactionResponse, +}; +use super::decompile_signed_transaction_intent::{ + DecompileSignedTransactionIntentHandler, DecompileSignedTransactionIntentRequest, + DecompileSignedTransactionIntentResponse, }; -use crate::{ - traverse_instruction, DecompileNotarizedTransactionHandler, - DecompileSignedTransactionIntentHandler, DecompileTransactionIntentHandler, Error, Instruction, - InstructionKind, NotarizedTransaction, SignedTransactionIntent, TransactionIntent, - TransactionManifest, ValueAliasingVisitor, +use super::decompile_transaction_intent::{ + DecompileTransactionIntentHandler, DecompileTransactionIntentRequest, + DecompileTransactionIntentResponse, }; -use serializable::serializable; +use super::traits::Handler; +use crate::error::Error; +use crate::error::Result; +use crate::model::transaction::{ + InstructionList, NotarizedTransaction, SignedTransactionIntent, TransactionIntent, + TransactionManifest, +}; +use crate::model::{instruction::Instruction, transaction::InstructionKind}; +use crate::visitor::traverse_instruction; +use crate::visitor::ValueAliasingVisitor; + +use toolkit_derive::serializable; // ================= // Model Definition @@ -167,9 +177,7 @@ impl Handler for DeriveBabylonAddressFromOlympiaAddressHandler +{ + fn pre_process( + request: DeriveBabylonAddressFromOlympiaAddressRequest, + ) -> Result { + Ok(request) + } + + fn handle( + request: &DeriveBabylonAddressFromOlympiaAddressRequest, + ) -> Result { + // All Olympia addresses begin with a letter and then `d` `x`. Verify that the passed string + // is of an Olympia account address + if let (Some('d'), Some('x')) = ( + request.olympia_account_address.chars().nth(1), + request.olympia_account_address.chars().nth(2), + ) { + Ok(()) + } else { + Err(Error::NotAnOlympiaAddress { + address: request.olympia_account_address.clone(), + }) + }?; + + // Bech32 decode the passed address. If the Bech32 variant is not Bech32, then this is not + // an Olympia address + let (_, data, variant) = bech32::decode(&request.olympia_account_address) + .map_err(AddressError::Bech32mDecodingError)?; + if let bech32::Variant::Bech32 = variant { + Ok(()) + } else { + Err(Error::NotAnOlympiaAddress { + address: request.olympia_account_address.clone(), + }) + }?; + + // Convert from 5 bits to 8 bits. + let mut data = Vec::::from_base32(&data).map_err(AddressError::Bech32mDecodingError)?; + + // Check the length of the data to ensure that it's a public key. Length should be 1 + 33 + // where the added 1 byte is because of the 0x04 prefix that public keys have. + if data.len() != 34 || data.remove(0) != 4 { + Err(Error::NotAnOlympiaAddress { + address: request.olympia_account_address.clone(), + })?; + }; + + // At this point, the data is of a valid Ecdsa Secp256k1 public key. We can now derive the + // virtual account address associated with this public key. + let public_key = EcdsaSecp256k1PublicKey(checked_copy_u8_slice(data)?); + + Ok(DeriveBabylonAddressFromOlympiaAddressResponse { + babylon_account_address: NetworkAwareComponentAddress { + address: ComponentAddress::virtual_account_from_public_key(&public_key), + network_id: request.network_id, + }, + public_key: public_key.into(), + }) + } + + fn post_process( + _: &DeriveBabylonAddressFromOlympiaAddressRequest, + response: DeriveBabylonAddressFromOlympiaAddressResponse, + ) -> Result { + Ok(response) + } +} diff --git a/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs b/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs index 85cb7f21..b9ef7c3c 100644 --- a/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs +++ b/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs @@ -15,10 +15,11 @@ // specific language governing permissions and limitations // under the License. -use crate::request::Handler; -use crate::{error::Result, NonFungibleGlobalId}; +use crate::error::Result; +use crate::model::address::NonFungibleGlobalId; +use crate::request::traits::Handler; use scrypto::prelude::{FromPublicKey, PublicKey}; -use serializable::serializable; +use toolkit_derive::serializable; // ================= // Model Definition @@ -45,9 +46,6 @@ pub struct DeriveNonFungibleGlobalIdFromPublicKeyRequest { pub struct DeriveNonFungibleGlobalIdFromPublicKeyResponse { /// The non-fungible global id of the virtual badge associated with the given public key. The /// underlying type of this is a `NonFungibleGlobalId` from the `Value` model. - #[serde(flatten)] // TODO: Remove after betanet v2 - #[schemars(with = "crate::model::Value")] - #[serde_as(as = "serde_with::TryFromInto")] pub non_fungible_global_id: NonFungibleGlobalId, } @@ -75,7 +73,7 @@ impl let non_fungible_global_id = scrypto::prelude::NonFungibleGlobalId::from_public_key(&request.public_key); let non_fungible_global_id = NonFungibleGlobalId { - resource_address: crate::NetworkAwareResourceAddress { + resource_address: crate::model::address::NetworkAwareResourceAddress { network_id: request.network_id, address: non_fungible_global_id.resource_address(), }, diff --git a/radix-engine-toolkit/src/request/derive_virtual_account_address.rs b/radix-engine-toolkit/src/request/derive_virtual_account_address.rs index c4d5c81d..a298fb59 100644 --- a/radix-engine-toolkit/src/request/derive_virtual_account_address.rs +++ b/radix-engine-toolkit/src/request/derive_virtual_account_address.rs @@ -16,10 +16,13 @@ // under the License. use scrypto::prelude::{ComponentAddress, PublicKey}; -use serializable::serializable; +use toolkit_derive::serializable; use crate::error::Result; -use crate::{Handler, NetworkAwareComponentAddress}; +use crate::model::address::EntityAddress; +use crate::model::address::NetworkAwareComponentAddress; + +use super::traits::Handler; // ================= // Model Definition @@ -47,8 +50,8 @@ pub struct DeriveVirtualAccountAddressRequest { pub struct DeriveVirtualAccountAddressResponse { /// The virtual account component address serialized as a `ComponentAddress` from the `Value` /// model. - #[schemars(with = "crate::model::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub virtual_account_address: NetworkAwareComponentAddress, } diff --git a/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs b/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs index 3d64d932..b12fce5a 100644 --- a/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs +++ b/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs @@ -16,10 +16,12 @@ // under the License. use scrypto::prelude::{ComponentAddress, PublicKey}; -use serializable::serializable; +use toolkit_derive::serializable; use crate::error::Result; -use crate::{Handler, NetworkAwareComponentAddress}; +use crate::model::address::EntityAddress; +use crate::model::address::NetworkAwareComponentAddress; +use crate::request::traits::Handler; // ================= // Model Definition @@ -47,8 +49,8 @@ pub struct DeriveVirtualIdentityAddressRequest { pub struct DeriveVirtualIdentityAddressResponse { /// The virtual identity component address serialized as a `ComponentAddress` from the `Value` /// model. - #[schemars(with = "crate::model::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub virtual_identity_address: NetworkAwareComponentAddress, } diff --git a/radix-engine-toolkit/src/request/encode_address.rs b/radix-engine-toolkit/src/request/encode_address.rs index 5e74fd65..41e8afde 100644 --- a/radix-engine-toolkit/src/request/encode_address.rs +++ b/radix-engine-toolkit/src/request/encode_address.rs @@ -16,8 +16,9 @@ // under the License. use crate::error::Result; -use crate::{model::address::EntityAddress, Handler}; -use serializable::serializable; +use crate::model::address::EntityAddress; +use crate::request::traits::Handler; +use toolkit_derive::serializable; // ================= // Model Definition @@ -60,11 +61,11 @@ pub struct EncodeAddressResponse { pub struct EncodeAddressHandler; impl Handler for EncodeAddressHandler { - fn pre_process(request: EncodeAddressRequest) -> crate::Result { + fn pre_process(request: EncodeAddressRequest) -> crate::error::Result { Ok(request) } - fn handle(request: &EncodeAddressRequest) -> crate::Result { + fn handle(request: &EncodeAddressRequest) -> crate::error::Result { EntityAddress::from_u8_array(&request.address_bytes, request.network_id) .map(|address| EncodeAddressResponse { address }) } diff --git a/radix-engine-toolkit/src/request/hash.rs b/radix-engine-toolkit/src/request/hash.rs new file mode 100644 index 00000000..b4d6e58c --- /dev/null +++ b/radix-engine-toolkit/src/request/hash.rs @@ -0,0 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 + +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::error::Result; +use crate::model::constants::RADIX_ENGINE_HASH_LENGTH; + +use scrypto::prelude::hash; +use toolkit_derive::serializable; + +use super::traits::Handler; + +// ================= +// Model Definition +// ================= + +/// Hashes data using the hashing algorithm used in Scrypto and the Radix Engine +#[serializable] +pub struct HashRequest { + /// The payload to hash + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[serde_as(as = "serde_with::hex::Hex")] + pub payload: Vec, +} + +/// The response of the [`HashRequest`] +#[serializable] +pub struct HashResponse { + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9a-fA-F]+"))] + #[serde_as(as = "serde_with::hex::Hex")] + pub value: [u8; RADIX_ENGINE_HASH_LENGTH], +} + +// =============== +// Implementation +// =============== + +pub struct HashHandler; + +impl Handler for HashHandler { + fn pre_process(request: HashRequest) -> Result { + Ok(request) + } + + fn handle(request: &HashRequest) -> Result { + let response = HashResponse { + value: hash(&request.payload).0, + }; + Ok(response) + } + + fn post_process(_: &HashRequest, response: HashResponse) -> Result { + Ok(response) + } +} diff --git a/radix-engine-toolkit/src/request/information.rs b/radix-engine-toolkit/src/request/information.rs index 0a654df4..a90a909a 100644 --- a/radix-engine-toolkit/src/request/information.rs +++ b/radix-engine-toolkit/src/request/information.rs @@ -16,8 +16,8 @@ // under the License. use crate::error::Result; -use crate::request::Handler; -use serializable::serializable; +use crate::request::traits::Handler; +use toolkit_derive::serializable; // ================= // Model Definition @@ -40,7 +40,7 @@ pub struct InformationResponse { /// The hash of the commit that this build of the Radix Engine Toolkit was built against. This /// is useful when doing any form of debugging and trying to determine the version of the /// library - pub git_hash: String, + pub last_commit_hash: String, } // =============== @@ -57,7 +57,7 @@ impl Handler for InformationHandler { fn handle(_: &InformationRequest) -> Result { let response = InformationResponse { package_version: env!("CARGO_PKG_VERSION").into(), - git_hash: env!("GIT_HASH").into(), + last_commit_hash: env!("GIT_HASH").into(), }; Ok(response) } diff --git a/radix-engine-toolkit/src/request/known_entity_addresses.rs b/radix-engine-toolkit/src/request/known_entity_addresses.rs index 9229b168..d7eb072f 100644 --- a/radix-engine-toolkit/src/request/known_entity_addresses.rs +++ b/radix-engine-toolkit/src/request/known_entity_addresses.rs @@ -16,15 +16,16 @@ // under the License. use crate::error::Result; -use crate::request::Handler; -use crate::{ - NetworkAwareComponentAddress, NetworkAwarePackageAddress, NetworkAwareResourceAddress, +use crate::model::address::{ + EntityAddress, NetworkAwareComponentAddress, NetworkAwarePackageAddress, + NetworkAwareResourceAddress, }; +use crate::request::traits::Handler; use scrypto::prelude::{ ACCOUNT_PACKAGE, CLOCK, ECDSA_SECP256K1_TOKEN, EDDSA_ED25519_TOKEN, EPOCH_MANAGER, FAUCET_COMPONENT, FAUCET_PACKAGE, PACKAGE_TOKEN, RADIX_TOKEN, SYSTEM_TOKEN, }; -use serializable::serializable; +use toolkit_derive::serializable; // ================= // Model Definition @@ -50,62 +51,62 @@ pub struct KnownEntityAddressesRequest { pub struct KnownEntityAddressesResponse { /// A component address serialized as a `ComponentAddress` from the `Value` model which /// represents the address of the faucet component on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub faucet_component_address: NetworkAwareComponentAddress, /// A package address serialized as a `PackageAddress` from the `Value` model which represents /// the address of the faucet package on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub faucet_package_address: NetworkAwarePackageAddress, /// A package address serialized as a `PackageAddress` from the `Value` model which represents /// the address of the account package on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub account_package_address: NetworkAwarePackageAddress, /// A resource address serialized as a `ResourceAddress` from the `Value` model which /// represents the address of the XRD resource on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub xrd_resource_address: NetworkAwareResourceAddress, /// A resource address serialized as a `ResourceAddress` from the `Value` model which /// represents the address of the system resource on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub system_token_resource_address: NetworkAwareResourceAddress, /// A resource address serialized as a `ResourceAddress` from the `Value` model which /// represents the address of the Ecdsa Secp256k1 resource on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub ecdsa_secp256k1_token_resource_address: NetworkAwareResourceAddress, /// A resource address serialized as a `ResourceAddress` from the `Value` model which /// represents the address of the EdDSA Ed25519 resource on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub eddsa_ed25519_token_resource_address: NetworkAwareResourceAddress, /// A resource address serialized as a `ResourceAddress` from the `Value` model which /// represents the address of the package token resource on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub package_token_resource_address: NetworkAwareResourceAddress, /// A system address serialized as a `ComponentAddress` from the `Value` model which represents /// the address of the epoch manager on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub epoch_manager_system_address: NetworkAwareComponentAddress, /// A system address serialized as a `ComponentAddress` from the `Value` model which represents /// the address of the clock on the requested network. - #[schemars(with = "crate::model::value::Value")] - #[serde_as(as = "serde_with::TryFromInto")] + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] pub clock_system_address: NetworkAwareComponentAddress, } diff --git a/radix-engine-toolkit/src/request/mod.rs b/radix-engine-toolkit/src/request/mod.rs index 7617331d..f6bf3cbb 100644 --- a/radix-engine-toolkit/src/request/mod.rs +++ b/radix-engine-toolkit/src/request/mod.rs @@ -36,33 +36,55 @@ pub mod encode_address; pub mod sbor_decode; pub mod sbor_encode; +pub mod derive_babylon_address_from_olympia_address; pub mod derive_non_fungible_global_id_from_public_key; pub mod derive_virtual_account_address; pub mod derive_virtual_identity_address; pub mod analyze_manifest; +#[cfg(feature = "radix-engine")] +pub mod analyze_manifest_with_preview_context; + pub mod known_entity_addresses; pub mod statically_validate_transaction; +pub mod hash; + pub mod traits; -pub use analyze_manifest::*; -pub use compile_notarized_transaction::*; -pub use compile_signed_transaction_intent::*; -pub use compile_transaction_intent::*; +pub use information::*; + pub use convert_manifest::*; -pub use decode_address::*; -pub use decompile_notarized_transaction::*; -pub use decompile_signed_transaction_intent::*; + +pub use compile_transaction_intent::*; pub use decompile_transaction_intent::*; + +pub use compile_signed_transaction_intent::*; +pub use decompile_signed_transaction_intent::*; + +pub use compile_notarized_transaction::*; +pub use decompile_notarized_transaction::*; + pub use decompile_unknown_intent::*; + +pub use decode_address::*; +pub use encode_address::*; + +pub use sbor_decode::*; +pub use sbor_encode::*; + +pub use derive_babylon_address_from_olympia_address::*; pub use derive_non_fungible_global_id_from_public_key::*; pub use derive_virtual_account_address::*; pub use derive_virtual_identity_address::*; -pub use encode_address::*; -pub use information::*; + +pub use analyze_manifest::*; +#[cfg(feature = "radix-engine")] +pub use analyze_manifest_with_preview_context::*; + pub use known_entity_addresses::*; -pub use sbor_decode::*; -pub use sbor_encode::*; pub use statically_validate_transaction::*; + +pub use hash::*; + pub use traits::*; diff --git a/radix-engine-toolkit/src/request/sbor_decode.rs b/radix-engine-toolkit/src/request/sbor_decode.rs index 34beef6e..0370e0b6 100644 --- a/radix-engine-toolkit/src/request/sbor_decode.rs +++ b/radix-engine-toolkit/src/request/sbor_decode.rs @@ -15,11 +15,15 @@ // specific language governing permissions and limitations // under the License. -use crate::error::Result; -use crate::request::Handler; -use crate::value::Value; -use crate::{traverse_value, ValueAliasingVisitor}; -use serializable::serializable; +use crate::error::{Error, Result}; +use crate::model::value::manifest_sbor::ManifestSborValue; +use crate::model::value::scrypto_sbor::ScryptoSborValue; +use crate::request::traits::Handler; +use scrypto::prelude::{ + manifest_decode, scrypto_decode, ManifestValue, ScryptoValue, MANIFEST_SBOR_V1_PAYLOAD_PREFIX, + SCRYPTO_SBOR_V1_PAYLOAD_PREFIX, +}; +use toolkit_derive::serializable; // ================= // Model Definition @@ -48,9 +52,10 @@ pub struct SborDecodeRequest { /// The response from the [`SborDecodeRequest`]. #[serializable] -pub struct SborDecodeResponse { - /// A value representing the SBOR decoded form of the passed SBOR buffer. - pub value: Value, +#[serde(tag = "type", content = "value")] +pub enum SborDecodeResponse { + ScryptoSbor(ScryptoSborValue), + ManifestSbor(ManifestSborValue), } // =============== @@ -65,23 +70,46 @@ impl Handler for SborDecodeHandler { } fn handle(request: &SborDecodeRequest) -> Result { - Value::decode(&request.encoded_value, request.network_id) - .map(|value| SborDecodeResponse { value }) + match request.encoded_value.first().copied() { + Some(SCRYPTO_SBOR_V1_PAYLOAD_PREFIX) => { + scrypto_decode::(&request.encoded_value) + .map(|scrypto_value| { + ScryptoSborValue::from_scrypto_sbor_value( + &scrypto_value, + request.network_id, + ) + }) + .map(SborDecodeResponse::ScryptoSbor) + .map_err(Error::from) + } + Some(MANIFEST_SBOR_V1_PAYLOAD_PREFIX) => { + manifest_decode::(&request.encoded_value) + .map_err(Error::from) + .and_then(|manifest_value| { + ManifestSborValue::from_manifest_sbor_value( + &manifest_value, + request.network_id, + ) + .map_err(Error::from) + }) + .map(SborDecodeResponse::ManifestSbor) + .map_err(Error::from) + } + Some(p) => Err(Error::InvalidSborPrefix { + expected: vec![ + SCRYPTO_SBOR_V1_PAYLOAD_PREFIX, + MANIFEST_SBOR_V1_PAYLOAD_PREFIX, + ], + found: p, + }), + None => Err(Error::EmptyPayloadError), + } } fn post_process( _: &SborDecodeRequest, - mut response: SborDecodeResponse, + response: SborDecodeResponse, ) -> Result { - // Visitors - let mut aliasing_visitor = ValueAliasingVisitor::default(); - - // Traverse value with visitors - traverse_value(&mut response.value, &mut [&mut aliasing_visitor])?; - - // The aliasing visitor performs all of the modifications in place as it meets them. Nothing - // else needs to be done here. - Ok(response) } } diff --git a/radix-engine-toolkit/src/request/sbor_encode.rs b/radix-engine-toolkit/src/request/sbor_encode.rs index 25f67ff6..c0d71116 100644 --- a/radix-engine-toolkit/src/request/sbor_encode.rs +++ b/radix-engine-toolkit/src/request/sbor_encode.rs @@ -16,9 +16,11 @@ // under the License. use crate::error::Result; -use crate::request::Handler; -use crate::value::Value; -use serializable::serializable; +use crate::model::value::manifest_sbor::ManifestSborValue; +use crate::model::value::scrypto_sbor::ScryptoSborValue; +use crate::request::traits::Handler; +use scrypto::prelude::{manifest_encode, scrypto_encode}; +use toolkit_derive::serializable; // ================= // Model Definition @@ -27,10 +29,10 @@ use serializable::serializable; /// This request takes in a [`Value`] and attempts to SBOR encode it and return back an SBOR byte /// array. #[serializable] -pub struct SborEncodeRequest { - /// The value to SBOR encode. - #[serde(flatten)] - pub value: Value, +#[serde(tag = "type", content = "value")] +pub enum SborEncodeRequest { + ScryptoSbor(ScryptoSborValue), + ManifestSbor(ManifestSborValue), } /// The response from the [`SborEncodeRequest`]. @@ -55,10 +57,14 @@ impl Handler for SborEncodeHandler { } fn handle(request: &SborEncodeRequest) -> Result { - request - .value - .encode() - .map(|encoded_value| SborEncodeResponse { encoded_value }) + match request { + SborEncodeRequest::ManifestSbor(value) => Ok(SborEncodeResponse { + encoded_value: manifest_encode(&value.to_manifest_sbor_value()?)?, + }), + SborEncodeRequest::ScryptoSbor(value) => Ok(SborEncodeResponse { + encoded_value: scrypto_encode(&value.to_scrypto_sbor_value()?)?, + }), + } } fn post_process( diff --git a/radix-engine-toolkit/src/request/statically_validate_transaction.rs b/radix-engine-toolkit/src/request/statically_validate_transaction.rs index 9803a925..beebe008 100644 --- a/radix-engine-toolkit/src/request/statically_validate_transaction.rs +++ b/radix-engine-toolkit/src/request/statically_validate_transaction.rs @@ -16,13 +16,14 @@ // under the License. use crate::error::Result; -use crate::transaction::NotarizedTransaction; +use crate::model::transaction::{InstructionKind, NotarizedTransaction}; +use crate::traits::CompilableIntent; use native_transaction::validation::{ NotarizedTransactionValidator, TestIntentHashManager, TransactionValidator, ValidationConfig, }; -use serializable::serializable; +use toolkit_derive::serializable; -use crate::{CompilableIntent, Handler}; +use crate::request::traits::Handler; // ================= // Model Definition @@ -50,6 +51,7 @@ pub struct StaticallyValidateTransactionRequest { /// The response from [`StaticallyValidateTransactionRequest`]. #[serializable] #[serde(tag = "validity")] +#[derive(PartialEq, Eq)] pub enum StaticallyValidateTransactionResponse { Valid, Invalid { error: String }, @@ -75,7 +77,7 @@ impl Handler Result { let notarized_transaction = NotarizedTransaction::decompile( &request.compiled_notarized_intent, - crate::InstructionKind::String, + InstructionKind::String, )?; let intent_hash_manager = TestIntentHashManager::new(); diff --git a/radix-engine-toolkit/src/traits.rs b/radix-engine-toolkit/src/traits.rs index d37e3383..d4566afc 100644 --- a/radix-engine-toolkit/src/traits.rs +++ b/radix-engine-toolkit/src/traits.rs @@ -1,4 +1,5 @@ -use crate::{error::Result, InstructionKind}; +use crate::error::Result; +use crate::model::transaction::InstructionKind; use scrypto::prelude::{hash, Hash}; /// A trait that defines the common interface of all compile-able intents diff --git a/radix-engine-toolkit/src/utils.rs b/radix-engine-toolkit/src/utils.rs index 59a6b889..1dadb2db 100644 --- a/radix-engine-toolkit/src/utils.rs +++ b/radix-engine-toolkit/src/utils.rs @@ -15,10 +15,13 @@ // specific language governing permissions and limitations // under the License. -use crate::error::Result; +use std::borrow::Borrow; + +use crate::error::{Error, Result}; use bech32; -use scrypto::radix_engine_interface::address::AddressError; -use scrypto::radix_engine_interface::node::NetworkDefinition; +use scrypto::address::AddressError; +use scrypto::network::NetworkDefinition; +use scrypto::prelude::ComponentAddress; /// A deterministic function that generates a network definition given a network ID. Implemented /// with reference to https://github.com/radixdlt/babylon-node/tree/main/common/src/main/java/com/radixdlt/networks/Network.java#L72-L99 @@ -127,3 +130,26 @@ pub fn network_id_from_address_string>(address: S) -> Result { bech32::decode(address.as_ref()).map_err(AddressError::Bech32mDecodingError)?; network_id_from_hrp(hrp) } + +pub fn is_account>(address: A) -> bool { + matches!( + address.borrow(), + ComponentAddress::Account(..) + | ComponentAddress::EcdsaSecp256k1VirtualAccount(..) + | ComponentAddress::EddsaEd25519VirtualAccount(..) + ) +} + +pub fn checked_copy_u8_slice, const N: usize>(slice: T) -> Result<[u8; N]> { + let slice = slice.as_ref(); + if slice.len() != N { + Err(Error::InvalidLength { + expected: N, + found: slice.len(), + }) + } else { + let mut bytes = [0u8; N]; + bytes.copy_from_slice(&slice[0..N]); + Ok(bytes) + } +} diff --git a/radix-engine-toolkit/src/visitor/instruction/account_deposits_visitor.rs b/radix-engine-toolkit/src/visitor/instruction/account_deposits_visitor.rs new file mode 100644 index 00000000..ea8eb1ed --- /dev/null +++ b/radix-engine-toolkit/src/visitor/instruction/account_deposits_visitor.rs @@ -0,0 +1,501 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +#![allow(clippy::map_entry)] + +use std::collections::{BTreeMap, BTreeSet, HashMap}; + +use crate::error::{Error, Result}; +use crate::model::address::{ + EntityAddress, NetworkAwareComponentAddress, NetworkAwareResourceAddress, +}; +use crate::model::engine_identifier::BucketId; +use crate::model::resource_specifier::ResourceSpecifier; +use crate::model::value::ast::{ManifestAstValue, ManifestAstValueKind}; +use crate::utils::is_account; +use crate::visitor::{traverse_value, InstructionVisitor, ManifestAstValueVisitor}; +use radix_engine::system::kernel_modules::execution_trace::{ + ResourceChange, ResourceSpecifier as NativeResourceSpecifier, WorktopChange, +}; +use radix_engine::types::RENodeId; +use scrypto::blueprints::account::{ACCOUNT_DEPOSIT_BATCH_IDENT, ACCOUNT_DEPOSIT_IDENT}; +use scrypto::prelude::ManifestExpression; +use toolkit_derive::serializable; + +/// A visitor whose main responsibility is analyzing the call-method instructions for proof creation +#[derive(Debug)] +pub struct AccountDepositsInstructionVisitor { + pub deposits: Vec, + pub resource_changes: HashMap>, + pub worktop_changes: HashMap>, + buckets: BTreeMap, + instruction_index: u32, + network_id: u8, +} + +impl AccountDepositsInstructionVisitor { + pub fn new( + network_id: u8, + resource_changes: HashMap>, + worktop_changes: HashMap>, + ) -> Self { + Self { + resource_changes, + worktop_changes, + deposits: Default::default(), + buckets: Default::default(), + instruction_index: Default::default(), + network_id, + } + } +} + +#[serializable] +#[derive(PartialEq, PartialOrd, Eq, Ord)] +pub struct AccountDeposit { + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] + pub component_address: NetworkAwareComponentAddress, + + #[serde(flatten)] + pub deposited: ExactnessSpecifier, +} + +#[serializable] +#[derive(PartialEq, PartialOrd, Eq, Ord)] +#[serde(tag = "type")] +pub enum ExactnessSpecifier { + Exact { + /// A specifier of the amount or ids of resources. + resource_specifier: ResourceSpecifier, + }, + Estimate { + /// The instruction index that that this amount originates from. This might either be an + /// instruction where a bucket is created of all worktop resources or an instruction where + /// a deposit is performed of an estimated amount. + #[schemars(with = "String")] + #[schemars(regex(pattern = "[0-9]+"))] + #[serde_as(as = "serde_with::DisplayFromStr")] + instruction_index: u32, + + /// A specifier of the amount or ids of resources. + resource_specifier: ResourceSpecifier, + }, +} + +impl InstructionVisitor for AccountDepositsInstructionVisitor { + //=================== + // Consuming Buckets + //=================== + + fn visit_call_function( + &mut self, + _: &mut ManifestAstValue, + _: &mut ManifestAstValue, + _: &mut ManifestAstValue, + arguments: &mut Option>, + ) -> crate::error::Result<()> { + // Consuming buckets + let consumed_buckets = { + let mut arguments = arguments.clone().unwrap_or_default(); + let mut visitor = BucketValueVisitor::default(); + for value in arguments.iter_mut() { + traverse_value(value, &mut [&mut visitor])?; + } + visitor.0 + }; + for bucket_id in consumed_buckets { + self.buckets.remove(&bucket_id).map_or( + Err(Error::InvalidBucketId { + bucket_id: bucket_id.clone(), + }), + |_| Ok(()), + )?; + } + Ok(()) + } + + fn visit_call_method( + &mut self, + component_address: &mut ManifestAstValue, + method_name: &mut ManifestAstValue, + arguments: &mut Option>, + ) -> crate::error::Result<()> { + let arguments = arguments.clone().unwrap_or_default(); + + // Checking for account deposits + match (component_address, method_name, &arguments) { + ( + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + }, + ManifestAstValue::String { value: method_name }, + arguments, + ) if is_account(component_address) && method_name == ACCOUNT_DEPOSIT_IDENT => { + if let Some(ManifestAstValue::Bucket { + identifier: bucket_id, + }) = arguments.get(0) + { + let bucket_info = self.buckets.get(bucket_id).map_or( + Err(Error::InvalidBucketId { + bucket_id: bucket_id.clone(), + }), + Ok, + )?; + self.deposits.push(AccountDeposit { + component_address: component_address.to_owned(), + deposited: bucket_info.to_owned(), + }); + } + } + ( + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + }, + ManifestAstValue::String { value: method_name }, + arguments, + ) if is_account(component_address) && method_name == ACCOUNT_DEPOSIT_BATCH_IDENT => { + match (arguments.len(), arguments.get(0)) { + ( + 1, + Some(ManifestAstValue::Expression { + value: ManifestExpression::EntireWorktop, + }), + ) => { + let resource_changes = self + .resource_changes + .get(&self.instruction_index) + .map_or( + Err(Error::NoResourceChangesForInstruction { + instruction_index: self.instruction_index, + }), + Ok, + )? + .iter() + .filter( + |ResourceChange { + node_id, amount, .. + }| { + *node_id + == RENodeId::GlobalObject( + radix_engine::types::Address::Component( + component_address.address, + ), + ) + && amount.is_positive() + }, + ) + .collect::>(); + + for resource_change in resource_changes { + self.deposits.push(AccountDeposit { + component_address: component_address.to_owned(), + deposited: ExactnessSpecifier::Estimate { + instruction_index: self.instruction_index, + resource_specifier: ResourceSpecifier::Amount { + resource_address: NetworkAwareResourceAddress { + address: resource_change.resource_address, + network_id: self.network_id, + }, + amount: resource_change.amount, + }, + }, + }); + } + } + ( + 1, + Some(ManifestAstValue::Array { + element_kind: ManifestAstValueKind::Bucket, + elements: bucket_ids, + }), + ) => { + let bucket_ids = { + let mut resolved_bucket_ids = BTreeSet::new(); + for bucket_id in bucket_ids { + if let ManifestAstValue::Bucket { identifier } = bucket_id { + resolved_bucket_ids.insert(identifier.clone()); + } else { /* TODO: currently a no-op. Should be an error? */ + } + } + resolved_bucket_ids + }; + for bucket_id in bucket_ids { + let bucket_info = self.buckets.get(&bucket_id).map_or( + Err(Error::InvalidBucketId { + bucket_id: bucket_id.clone(), + }), + Ok, + )?; + self.deposits.push(AccountDeposit { + component_address: component_address.to_owned(), + deposited: bucket_info.to_owned(), + }); + } + } + (_, _) => { /* No OP. TODO: Should be an error? */ } + } + } + _ => {} + } + + // Consuming buckets + let consumed_buckets = { + let mut arguments = arguments; + let mut visitor = BucketValueVisitor::default(); + for value in arguments.iter_mut() { + traverse_value(value, &mut [&mut visitor])?; + } + visitor.0 + }; + for bucket_id in consumed_buckets { + self.buckets.remove(&bucket_id).map_or( + Err(Error::InvalidBucketId { + bucket_id: bucket_id.clone(), + }), + |_| Ok(()), + )?; + } + Ok(()) + } + + fn visit_take_from_worktop( + &mut self, + resource_address: &mut ManifestAstValue, + into_bucket: &mut ManifestAstValue, + ) -> Result<()> { + if let ( + ManifestAstValue::Address { + address: + EntityAddress::ResourceAddress { + address: resource_address, + }, + }, + ManifestAstValue::Bucket { + identifier: bucket_id, + }, + ) = (resource_address, into_bucket) + { + // TODO: Should we do a sanity check that the resource address in the instruction + // matches that in the worktop changes? + if let Some(worktop_changes) = self.worktop_changes.get(&self.instruction_index) { + if let Some(WorktopChange::Take(resource_specifier)) = worktop_changes.get(0) { + self.add_bucket( + bucket_id.clone(), + ExactnessSpecifier::Estimate { + instruction_index: self.instruction_index, + resource_specifier: match resource_specifier { + NativeResourceSpecifier::Amount(_, amount) => { + ResourceSpecifier::Amount { + resource_address: *resource_address, + amount: *amount, + } + } + NativeResourceSpecifier::Ids(_, ids) => ResourceSpecifier::Ids { + resource_address: *resource_address, + ids: ids.clone(), + }, + }, + }, + )?; + } + } + } + Ok(()) + } + + fn visit_take_from_worktop_by_amount( + &mut self, + resource_address: &mut ManifestAstValue, + amount: &mut ManifestAstValue, + into_bucket: &mut ManifestAstValue, + ) -> Result<()> { + if let ( + ManifestAstValue::Address { + address: + EntityAddress::ResourceAddress { + address: resource_address, + }, + }, + ManifestAstValue::Decimal { value: amount }, + ManifestAstValue::Bucket { + identifier: bucket_id, + }, + ) = (resource_address, amount, into_bucket) + { + self.add_bucket( + bucket_id.clone(), + ExactnessSpecifier::Exact { + resource_specifier: ResourceSpecifier::Amount { + resource_address: NetworkAwareResourceAddress { + network_id: self.network_id, + address: resource_address.address, + }, + amount: *amount, + }, + }, + )?; + } + Ok(()) + } + + fn visit_take_from_worktop_by_ids( + &mut self, + resource_address: &mut ManifestAstValue, + ids: &mut Vec, + into_bucket: &mut ManifestAstValue, + ) -> Result<()> { + if let ( + ManifestAstValue::Address { + address: + EntityAddress::ResourceAddress { + address: resource_address, + }, + }, + ids, + ManifestAstValue::Bucket { + identifier: bucket_id, + }, + ) = (resource_address, ids, into_bucket) + { + let ids = { + let mut resolved_ids = BTreeSet::new(); + for id in ids { + if let ManifestAstValue::NonFungibleLocalId { value: id } = id { + resolved_ids.insert(id.clone()); + } else { /* TODO: currently a no-op. Should be an error? */ + } + } + resolved_ids + }; + self.add_bucket( + bucket_id.clone(), + ExactnessSpecifier::Exact { + resource_specifier: ResourceSpecifier::Ids { + ids, + resource_address: NetworkAwareResourceAddress { + network_id: self.network_id, + address: resource_address.address, + }, + }, + }, + )?; + } + Ok(()) + } + + //================== + // Creating Buckets + //================== + + fn visit_return_to_worktop(&mut self, bucket: &mut ManifestAstValue) -> Result<()> { + if let ManifestAstValue::Bucket { + identifier: bucket_id, + } = bucket + { + self.buckets.remove(bucket_id).map_or( + Err(Error::InvalidBucketId { + bucket_id: bucket_id.clone(), + }), + |_| Ok(()), + ) + } else { + // TODO: Should be an error? + Ok(()) + } + } + + fn visit_burn_resource(&mut self, bucket: &mut ManifestAstValue) -> Result<()> { + if let ManifestAstValue::Bucket { + identifier: bucket_id, + } = bucket + { + self.buckets.remove(bucket_id).map_or( + Err(Error::InvalidBucketId { + bucket_id: bucket_id.clone(), + }), + |_| Ok(()), + ) + } else { + // TODO: Should be an error? + Ok(()) + } + } + + fn visit_create_access_controller( + &mut self, + bucket: &mut ManifestAstValue, + _: &mut ManifestAstValue, + _: &mut ManifestAstValue, + ) -> Result<()> { + if let ManifestAstValue::Bucket { + identifier: bucket_id, + } = bucket + { + self.buckets.remove(bucket_id).map_or( + Err(Error::InvalidBucketId { + bucket_id: bucket_id.clone(), + }), + |_| Ok(()), + ) + } else { + // TODO: Should be an error? + Ok(()) + } + } + + //================= + // Post Processing + //================= + + fn post_visit(&mut self) -> Result<()> { + self.instruction_index += 1; + Ok(()) + } +} + +impl AccountDepositsInstructionVisitor { + pub fn add_bucket(&mut self, bucket_id: BucketId, specifier: ExactnessSpecifier) -> Result<()> { + if !self.buckets.contains_key(&bucket_id) { + self.buckets.insert(bucket_id, specifier); + Ok(()) + } else { + Err(Error::BucketExistsError { bucket_id }) + } + } +} + +#[derive(Default)] +struct BucketValueVisitor(Vec); + +impl ManifestAstValueVisitor for BucketValueVisitor { + fn visit_bucket(&mut self, bucket: &mut ManifestAstValue) -> Result<()> { + if let ManifestAstValue::Bucket { + identifier: bucket_id, + } = bucket + { + self.0.push(bucket_id.to_owned()); + } + Ok(()) + } +} diff --git a/radix-engine-toolkit/src/visitor/instruction/account_interactions_visitor.rs b/radix-engine-toolkit/src/visitor/instruction/account_interactions_visitor.rs index 540ff607..16b76c04 100644 --- a/radix-engine-toolkit/src/visitor/instruction/account_interactions_visitor.rs +++ b/radix-engine-toolkit/src/visitor/instruction/account_interactions_visitor.rs @@ -1,7 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + use std::collections::BTreeSet; -use crate::{InstructionVisitor, NetworkAwareComponentAddress, Value}; -use scrypto::prelude::ComponentAddress; +use scrypto::blueprints::account::*; + +use crate::error::Result; +use crate::model::address::{EntityAddress, NetworkAwareComponentAddress}; +use crate::model::value::ast::ManifestAstValue; +use crate::utils::is_account; +use crate::visitor::InstructionVisitor; /// A visitor whose main responsibility is determining the kind of interactions involved with /// accounts @@ -14,140 +36,135 @@ pub struct AccountInteractionsInstructionVisitor { impl AccountInteractionsInstructionVisitor { const AUTH_REQUIRING_METHODS: &'static [&'static str] = &[ - "lock_fee", - "lock_contingent_fee", - "withdraw", - "withdraw_by_amount", - "withdraw_by_ids", - "lock_fee_and_withdraw", - "lock_fee_and_withdraw_by_amount", - "lock_fee_and_withdraw_by_ids", - "create_proof", - "create_proof_by_amount", - "create_proof_by_ids", + ACCOUNT_LOCK_FEE_IDENT, + ACCOUNT_LOCK_CONTINGENT_FEE_IDENT, + ACCOUNT_WITHDRAW_IDENT, + ACCOUNT_WITHDRAW_NON_FUNGIBLES_IDENT, + ACCOUNT_LOCK_FEE_AND_WITHDRAW_IDENT, + ACCOUNT_LOCK_FEE_AND_WITHDRAW_NON_FUNGIBLES_IDENT, + ACCOUNT_CREATE_PROOF_IDENT, + ACCOUNT_CREATE_PROOF_BY_AMOUNT_IDENT, + ACCOUNT_CREATE_PROOF_BY_IDS_IDENT, + ]; + const WITHDRAW_METHODS: &'static [&'static str] = &[ + ACCOUNT_WITHDRAW_IDENT, + ACCOUNT_WITHDRAW_NON_FUNGIBLES_IDENT, + ACCOUNT_LOCK_FEE_AND_WITHDRAW_IDENT, + ACCOUNT_LOCK_FEE_AND_WITHDRAW_NON_FUNGIBLES_IDENT, ]; - const WITHDRAW_METHODS: &'static [&'static str] = - &["withdraw", "withdraw_by_amount", "withdraw_by_ids"]; - const DEPOSIT_METHODS: &'static [&'static str] = &["deposit", "deposit_batch"]; + const DEPOSIT_METHODS: &'static [&'static str] = + &[ACCOUNT_DEPOSIT_IDENT, ACCOUNT_DEPOSIT_BATCH_IDENT]; } impl InstructionVisitor for AccountInteractionsInstructionVisitor { fn visit_call_method( &mut self, - component_address: &mut Value, - method_name: &mut Value, - _: &mut Option>, - ) -> crate::Result<()> { - if let ( - Value::ComponentAddress { - address: - component_address @ NetworkAwareComponentAddress { - address: - ComponentAddress::Account(..) - | ComponentAddress::EcdsaSecp256k1VirtualAccount(..) - | ComponentAddress::EddsaEd25519VirtualAccount(..), - .. - }, - }, - Value::String { value: method_name }, - ) = (component_address, method_name) - { - if Self::AUTH_REQUIRING_METHODS.contains(&method_name.as_str()) { - self.auth_required.insert(*component_address); - } - if Self::WITHDRAW_METHODS.contains(&method_name.as_str()) { - self.accounts_withdrawn_from.insert(*component_address); - } - if Self::DEPOSIT_METHODS.contains(&method_name.as_str()) { - self.accounts_deposited_into.insert(*component_address); + component_address: &mut ManifestAstValue, + method_name: &mut ManifestAstValue, + _args: &mut Option>, + ) -> Result<()> { + // Checking for methods that require auth + match (component_address, method_name) { + ( + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + }, + ManifestAstValue::String { value: method_name }, + ) if is_account(component_address) => { + if Self::AUTH_REQUIRING_METHODS.contains(&method_name.as_str()) { + self.auth_required.insert(*component_address); + } + if Self::WITHDRAW_METHODS.contains(&method_name.as_str()) { + self.accounts_withdrawn_from.insert(*component_address); + } + if Self::DEPOSIT_METHODS.contains(&method_name.as_str()) { + self.accounts_deposited_into.insert(*component_address); + } } - }; + _ => {} + } + Ok(()) } fn visit_set_metadata( &mut self, - entity_address: &mut Value, - _: &mut Value, - _: &mut Value, - ) -> crate::Result<()> { - if let Value::ComponentAddress { - address: - component_address @ NetworkAwareComponentAddress { - address: - ComponentAddress::Account(..) - | ComponentAddress::EcdsaSecp256k1VirtualAccount(..) - | ComponentAddress::EddsaEd25519VirtualAccount(..), - .. - }, - } = entity_address - { - self.auth_required.insert(*component_address); - }; + entity_address: &mut ManifestAstValue, + _: &mut ManifestAstValue, + _: &mut ManifestAstValue, + ) -> Result<()> { + match entity_address { + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + } if is_account(component_address) => { + self.auth_required.insert(*component_address); + } + _ => {} + } + Ok(()) } fn visit_set_component_royalty_config( &mut self, - component_address: &mut crate::Value, - _: &mut crate::Value, - ) -> crate::Result<()> { - if let Value::ComponentAddress { - address: - component_address @ NetworkAwareComponentAddress { - address: - ComponentAddress::Account(..) - | ComponentAddress::EcdsaSecp256k1VirtualAccount(..) - | ComponentAddress::EddsaEd25519VirtualAccount(..), - .. - }, - } = component_address - { - self.auth_required.insert(*component_address); - }; + component_address: &mut crate::model::value::ast::ManifestAstValue, + _: &mut crate::model::value::ast::ManifestAstValue, + ) -> Result<()> { + match component_address { + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + } if is_account(component_address) => { + self.auth_required.insert(*component_address); + } + _ => {} + } Ok(()) } fn visit_claim_component_royalty( &mut self, - component_address: &mut crate::Value, - ) -> crate::Result<()> { - if let Value::ComponentAddress { - address: - component_address @ NetworkAwareComponentAddress { - address: - ComponentAddress::Account(..) - | ComponentAddress::EcdsaSecp256k1VirtualAccount(..) - | ComponentAddress::EddsaEd25519VirtualAccount(..), - .. - }, - } = component_address - { - self.auth_required.insert(*component_address); - }; + component_address: &mut crate::model::value::ast::ManifestAstValue, + ) -> Result<()> { + match component_address { + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + } if is_account(component_address) => { + self.auth_required.insert(*component_address); + } + _ => {} + } Ok(()) } fn visit_set_method_access_rule( &mut self, - entity_address: &mut crate::Value, - _: &mut crate::Value, - _: &mut crate::Value, - _: &mut crate::Value, - ) -> crate::Result<()> { - if let Value::ComponentAddress { - address: - component_address @ NetworkAwareComponentAddress { - address: - ComponentAddress::Account(..) - | ComponentAddress::EcdsaSecp256k1VirtualAccount(..) - | ComponentAddress::EddsaEd25519VirtualAccount(..), - .. - }, - } = entity_address - { - self.auth_required.insert(*component_address); - }; + entity_address: &mut crate::model::value::ast::ManifestAstValue, + _: &mut crate::model::value::ast::ManifestAstValue, + _: &mut crate::model::value::ast::ManifestAstValue, + ) -> Result<()> { + match entity_address { + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + } if is_account(component_address) => { + self.auth_required.insert(*component_address); + } + _ => {} + } Ok(()) } } diff --git a/radix-engine-toolkit/src/visitor/instruction/account_proofs_visitor.rs b/radix-engine-toolkit/src/visitor/instruction/account_proofs_visitor.rs new file mode 100644 index 00000000..c5e440c9 --- /dev/null +++ b/radix-engine-toolkit/src/visitor/instruction/account_proofs_visitor.rs @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::collections::BTreeSet; + +use scrypto::blueprints::account::*; + +use crate::error::Result; +use crate::model::address::{EntityAddress, NetworkAwareResourceAddress}; +use crate::model::value::ast::ManifestAstValue; +use crate::utils::is_account; +use crate::visitor::InstructionVisitor; + +/// A visitor whose main responsibility is analyzing the call-method instructions for proof creation +#[derive(Debug, Default)] +pub struct AccountProofsInstructionVisitor { + /// The resource addresses of the created proofs + pub created_proofs: BTreeSet, +} + +impl InstructionVisitor for AccountProofsInstructionVisitor { + fn visit_call_method( + &mut self, + component_address: &mut ManifestAstValue, + method_name: &mut ManifestAstValue, + args: &mut Option>, + ) -> Result<()> { + // Checking for instructions that create proofs from accounts. Since all that is of interest + // to us is the resource address then only the first argument needs to be analyzed. + let args = args.clone(); + match ( + component_address, + method_name, + args.unwrap_or_default().get(0), + ) { + ( + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + }, + ManifestAstValue::String { + value: ref method_name, + }, + Some(ManifestAstValue::Address { + address: + EntityAddress::ResourceAddress { + address: resource_address, + }, + }), + ) if is_account(component_address) + && (method_name == ACCOUNT_CREATE_PROOF_IDENT + || method_name == ACCOUNT_CREATE_PROOF_BY_AMOUNT_IDENT + || method_name == ACCOUNT_CREATE_PROOF_BY_IDS_IDENT) => + { + self.created_proofs.insert(*resource_address); + } + _ => {} + } + + Ok(()) + } +} diff --git a/radix-engine-toolkit/src/visitor/instruction/account_withdraws_visitor.rs b/radix-engine-toolkit/src/visitor/instruction/account_withdraws_visitor.rs new file mode 100644 index 00000000..cb154084 --- /dev/null +++ b/radix-engine-toolkit/src/visitor/instruction/account_withdraws_visitor.rs @@ -0,0 +1,235 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::collections::BTreeSet; + +use scrypto::blueprints::account::*; + +use crate::error::Result; +use crate::model::address::{EntityAddress, NetworkAwareComponentAddress}; +use crate::model::resource_specifier::ResourceSpecifier; +use crate::model::value::ast::{ManifestAstValue, ManifestAstValueKind}; +use crate::utils::is_account; +use crate::visitor::InstructionVisitor; +use toolkit_derive::serializable; + +/// A visitor whose main responsibility is analyzing the call-method instructions for proof creation +#[derive(Debug, Default)] +pub struct AccountWithdrawsInstructionVisitor(pub Vec); + +impl AccountWithdrawsInstructionVisitor { + pub fn add( + &mut self, + component_address: NetworkAwareComponentAddress, + resource_specifier: ResourceSpecifier, + ) { + self.0.push(AccountWithdraw { + component_address, + resource_specifier, + }); + } +} + +impl InstructionVisitor for AccountWithdrawsInstructionVisitor { + fn visit_call_method( + &mut self, + component_address: &mut ManifestAstValue, + method_name: &mut ManifestAstValue, + args: &mut Option>, + ) -> Result<()> { + let args = args.clone().unwrap_or_default(); + match ( + component_address, + method_name, + args.get(0), + args.get(1), + args.get(2), + ) { + // Withdraw from account by amount + ( + // Component Address + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + }, + // Method Name + ManifestAstValue::String { value: method_name }, + // Resource Address to withdraw + Some(ManifestAstValue::Address { + address: + EntityAddress::ResourceAddress { + address: resource_address, + }, + }), + // Amount to withdraw + Some(ManifestAstValue::Decimal { value: amount }), + None, + ) if is_account(component_address) && method_name == ACCOUNT_WITHDRAW_IDENT => self + .add( + component_address.to_owned(), + ResourceSpecifier::Amount { + amount: amount.to_owned(), + resource_address: resource_address.to_owned(), + }, + ), + // Withdraw from account by ids + ( + // Component Address + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + }, + // Method Name + ManifestAstValue::String { value: method_name }, + // Resource Address to withdraw + Some(ManifestAstValue::Address { + address: + EntityAddress::ResourceAddress { + address: resource_address, + }, + }), + // Set of non-fungible ids + Some(ManifestAstValue::Array { + element_kind: ManifestAstValueKind::NonFungibleLocalId, + elements: ids, + }), + None, + ) if is_account(component_address) + && method_name == ACCOUNT_WITHDRAW_NON_FUNGIBLES_IDENT => + { + let ids = { + let mut resolved_ids = BTreeSet::new(); + for id in ids { + if let ManifestAstValue::NonFungibleLocalId { value: id } = id { + resolved_ids.insert(id.clone()); + } else { /* TODO: currently a no-op. Should be an error? */ + } + } + resolved_ids + }; + self.add( + component_address.to_owned(), + ResourceSpecifier::Ids { + ids, + resource_address: resource_address.to_owned(), + }, + ) + } + // Lock fee and withdraw from account by amount + ( + // Component Address + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + }, + // Method name + ManifestAstValue::String { value: method_name }, + // Lock fee amount + Some(ManifestAstValue::Decimal { .. }), + // Resource address to withdraw + Some(ManifestAstValue::Address { + address: + EntityAddress::ResourceAddress { + address: resource_address, + }, + }), + // Amount to withdraw + Some(ManifestAstValue::Decimal { value: amount }), + ) if is_account(component_address) + && method_name == ACCOUNT_LOCK_FEE_AND_WITHDRAW_IDENT => + { + self.add( + component_address.to_owned(), + ResourceSpecifier::Amount { + amount: amount.to_owned(), + resource_address: resource_address.to_owned(), + }, + ) + } + // Lock fee and withdraw from account by ids + ( + // Component Address + ManifestAstValue::Address { + address: + EntityAddress::ComponentAddress { + address: ref component_address, + }, + }, + // Method Name + ManifestAstValue::String { value: method_name }, + // Amount to lock fee + Some(ManifestAstValue::Decimal { .. }), + // Resource Address + Some(ManifestAstValue::Address { + address: + EntityAddress::ResourceAddress { + address: resource_address, + }, + }), + // Array of non-fungible ids + Some(ManifestAstValue::Array { + element_kind: ManifestAstValueKind::NonFungibleLocalId, + elements: ids, + }), + ) if is_account(component_address) + && method_name == ACCOUNT_LOCK_FEE_AND_WITHDRAW_NON_FUNGIBLES_IDENT => + { + let ids = { + let mut resolved_ids = BTreeSet::new(); + for id in ids { + if let ManifestAstValue::NonFungibleLocalId { value: id } = id { + resolved_ids.insert(id.clone()); + } else { /* TODO: currently a no-op. Should be an error? */ + } + } + resolved_ids + }; + self.add( + component_address.to_owned(), + ResourceSpecifier::Ids { + ids, + resource_address: resource_address.to_owned(), + }, + ) + } + _ => { /* Ignore everything else */ } + } + Ok(()) + } +} + +#[serializable] +#[derive(PartialEq, PartialOrd, Eq, Ord)] +pub struct AccountWithdraw { + /// The component address of the account that the resources were withdrawn from. + #[schemars(with = "EntityAddress")] + #[serde_as(as = "serde_with::TryFromInto")] + component_address: NetworkAwareComponentAddress, + + /// A specifier used to specify what was withdrawn from the account - this could either be an + /// amount or a set of non-fungible local ids. + /// + /// When this vector has more than one item, it means that multiple instructions performed a + /// withdraw from the same account of the same resource. + resource_specifier: ResourceSpecifier, +} diff --git a/radix-engine-toolkit/src/visitor/instruction/instruction_visitor.rs b/radix-engine-toolkit/src/visitor/instruction/instruction_visitor.rs index 4582b6d1..2cfe8a1e 100644 --- a/radix-engine-toolkit/src/visitor/instruction/instruction_visitor.rs +++ b/radix-engine-toolkit/src/visitor/instruction/instruction_visitor.rs @@ -1,5 +1,6 @@ use crate::error::Result; -use crate::{traverse_value, Instruction, ValueVisitor}; +use crate::model::instruction::Instruction; +use crate::visitor::{traverse_value, ManifestAstValueVisitor}; macro_rules! define_instruction_visitor { ( @@ -11,7 +12,7 @@ macro_rules! define_instruction_visitor { $(#[$meta])* $vis trait $trait_ident { $( - fn $method_ident(&mut self, $($arg_ident: $arg_type,)*) -> $crate::Result<()> { + fn $method_ident(&mut self, $($arg_ident: $arg_type,)*) -> $crate::error::Result<()> { Ok(()) } )* @@ -24,7 +25,7 @@ macro_rules! visit { $visitors .iter_mut() .map(|visitor| visitor.$method($($value,)*)) - .collect::<$crate::Result>>() + .collect::<$crate::error::Result>>() }; } @@ -32,212 +33,215 @@ define_instruction_visitor! { /// An visitor which operates on [`crate::Instruction`]s. pub trait InstructionVisitor { visit_call_function( - _package_address: &mut crate::Value, - _blueprint_name: &mut crate::Value, - _function_name: &mut crate::Value, - _arguments: &mut Option> + _package_address: &mut crate::model::value::ast::ManifestAstValue, + _blueprint_name: &mut crate::model::value::ast::ManifestAstValue, + _function_name: &mut crate::model::value::ast::ManifestAstValue, + _arguments: &mut Option> ), visit_call_method( - _component_address: &mut crate::Value, - _method_name: &mut crate::Value, - _arguments: &mut Option> + _component_address: &mut crate::model::value::ast::ManifestAstValue, + _method_name: &mut crate::model::value::ast::ManifestAstValue, + _arguments: &mut Option> ), visit_take_from_worktop( - _resource_address: &mut crate::Value, - _into_bucket: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _into_bucket: &mut crate::model::value::ast::ManifestAstValue ), visit_take_from_worktop_by_amount( - _resource_address: &mut crate::Value, - _amount: &mut crate::Value, - _into_bucket: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _amount: &mut crate::model::value::ast::ManifestAstValue, + _into_bucket: &mut crate::model::value::ast::ManifestAstValue ), visit_take_from_worktop_by_ids( - _resource_address: &mut crate::Value, - _ids: &mut Vec, - _into_bucket: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _ids: &mut Vec, + _into_bucket: &mut crate::model::value::ast::ManifestAstValue ), visit_return_to_worktop( - _bucket: &mut crate::Value + _bucket: &mut crate::model::value::ast::ManifestAstValue ), visit_assert_worktop_contains( - _resource_address: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue ), visit_assert_worktop_contains_by_amount( - _resource_address: &mut crate::Value, - _amount: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _amount: &mut crate::model::value::ast::ManifestAstValue ), visit_assert_worktop_contains_by_ids( - _resource_address: &mut crate::Value, - _ids: &mut Vec + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _ids: &mut Vec ), visit_pop_from_auth_zone( - _into_proof: &mut crate::Value + _into_proof: &mut crate::model::value::ast::ManifestAstValue ), visit_push_to_auth_zone( - _proof: &mut crate::Value + _proof: &mut crate::model::value::ast::ManifestAstValue ), visit_create_proof_from_auth_zone( - _resource_address: &mut crate::Value, - _into_proof: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _into_proof: &mut crate::model::value::ast::ManifestAstValue ), visit_create_proof_from_auth_zone_by_amount( - _resource_address: &mut crate::Value, - _amount: &mut crate::Value, - _into_proof: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _amount: &mut crate::model::value::ast::ManifestAstValue, + _into_proof: &mut crate::model::value::ast::ManifestAstValue ), visit_create_proof_from_auth_zone_by_ids( - _resource_address: &mut crate::Value, - _ids: &mut Vec, - _into_proof: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _ids: &mut Vec, + _into_proof: &mut crate::model::value::ast::ManifestAstValue ), visit_create_proof_from_bucket( - _bucket: &mut crate::Value, - _into_proof: &mut crate::Value + _bucket: &mut crate::model::value::ast::ManifestAstValue, + _into_proof: &mut crate::model::value::ast::ManifestAstValue ), visit_clone_proof( - _proof: &mut crate::Value, - _into_proof: &mut crate::Value + _proof: &mut crate::model::value::ast::ManifestAstValue, + _into_proof: &mut crate::model::value::ast::ManifestAstValue ), visit_drop_proof( - _proof: &mut crate::Value + _proof: &mut crate::model::value::ast::ManifestAstValue ), visit_publish_package( - _code: &mut crate::Value, - _abi: &mut crate::Value, - _royalty_config: &mut crate::Value, - _metadata: &mut crate::Value, - _access_rules: &mut crate::Value - ), - - visit_publish_package_with_owner( - _code: &mut crate::Value, - _abi: &mut crate::Value, - _owner_badge: &mut crate::Value + _code: &mut crate::model::value::ast::ManifestAstValue, + _abi: &mut crate::model::value::ast::ManifestAstValue, + _royalty_config: &mut crate::model::value::ast::ManifestAstValue, + _metadata: &mut crate::model::value::ast::ManifestAstValue, + _access_rules: &mut crate::model::value::ast::ManifestAstValue ), visit_burn_resource( - _bucket: &mut crate::Value + _bucket: &mut crate::model::value::ast::ManifestAstValue ), visit_recall_resource( - _vault_id: &mut crate::Value, - _amount: &mut crate::Value + _vault_id: &mut crate::model::value::ast::ManifestAstValue, + _amount: &mut crate::model::value::ast::ManifestAstValue ), visit_set_metadata( - _entity_address: &mut crate::Value, - _key: &mut crate::Value, - _value: &mut crate::Value + _entity_address: &mut crate::model::value::ast::ManifestAstValue, + _key: &mut crate::model::value::ast::ManifestAstValue, + _value: &mut crate::model::value::ast::ManifestAstValue + ), + + visit_remove_metadata( + _entity_address: &mut crate::model::value::ast::ManifestAstValue, + _key: &mut crate::model::value::ast::ManifestAstValue ), visit_set_package_royalty_config( - _package_address: &mut crate::Value, - _royalty_config: &mut crate::Value + _package_address: &mut crate::model::value::ast::ManifestAstValue, + _royalty_config: &mut crate::model::value::ast::ManifestAstValue ), visit_set_component_royalty_config( - _component_address: &mut crate::Value, - _royalty_config: &mut crate::Value + _component_address: &mut crate::model::value::ast::ManifestAstValue, + _royalty_config: &mut crate::model::value::ast::ManifestAstValue ), visit_claim_package_royalty( - _package_address: &mut crate::Value + _package_address: &mut crate::model::value::ast::ManifestAstValue ), visit_claim_component_royalty( - _component_address: &mut crate::Value + _component_address: &mut crate::model::value::ast::ManifestAstValue ), visit_set_method_access_rule( - _entity_address: &mut crate::Value, - _index: &mut crate::Value, - _key: &mut crate::Value, - _rule: &mut crate::Value + _entity_address: &mut crate::model::value::ast::ManifestAstValue, + _key: &mut crate::model::value::ast::ManifestAstValue, + _rule: &mut crate::model::value::ast::ManifestAstValue ), visit_mint_fungible( - _resource_address: &mut crate::Value, - _amount: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _amount: &mut crate::model::value::ast::ManifestAstValue ), visit_mint_non_fungible( - _resource_address: &mut crate::Value, - _entries: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _entries: &mut crate::model::value::ast::ManifestAstValue ), visit_mint_uuid_non_fungible( - _resource_address: &mut crate::Value, - _entries: &mut crate::Value + _resource_address: &mut crate::model::value::ast::ManifestAstValue, + _entries: &mut crate::model::value::ast::ManifestAstValue ), visit_create_fungible_resource( - _divisibility: &mut crate::Value, - _metadata: &mut crate::Value, - _access_rules: &mut crate::Value, - _initial_supply: &mut crate::Value + _divisibility: &mut crate::model::value::ast::ManifestAstValue, + _metadata: &mut crate::model::value::ast::ManifestAstValue, + _access_rules: &mut crate::model::value::ast::ManifestAstValue ), visit_create_fungible_resource_with_owner( - _divisibility: &mut crate::Value, - _metadata: &mut crate::Value, - _owner_badge: &mut crate::Value, - _initial_supply: &mut crate::Value + _divisibility: &mut crate::model::value::ast::ManifestAstValue, + _metadata: &mut crate::model::value::ast::ManifestAstValue, + _access_rules: &mut crate::model::value::ast::ManifestAstValue, + _initial_supply: &mut crate::model::value::ast::ManifestAstValue ), visit_create_non_fungible_resource( - _id_type: &mut crate::Value, - _metadata: &mut crate::Value, - _access_rules: &mut crate::Value, - _initial_supply: &mut crate::Value + _id_type: &mut crate::model::value::ast::ManifestAstValue, + _schema: &mut crate::model::value::ast::ManifestAstValue, + _metadata: &mut crate::model::value::ast::ManifestAstValue, + _access_rules: &mut crate::model::value::ast::ManifestAstValue ), visit_create_non_fungible_resource_with_owner( - _id_type: &mut crate::Value, - _metadata: &mut crate::Value, - _owner_badge: &mut crate::Value, - _initial_supply: &mut crate::Value + _id_type: &mut crate::model::value::ast::ManifestAstValue, + _schema: &mut crate::model::value::ast::ManifestAstValue, + _metadata: &mut crate::model::value::ast::ManifestAstValue, + _access_rules: &mut crate::model::value::ast::ManifestAstValue, + _initial_supply: &mut crate::model::value::ast::ManifestAstValue ), visit_create_access_controller( - _controlled_asset: &mut crate::Value, - _primary_role: &mut crate::Value, - _recovery_role: &mut crate::Value, - _confirmation_role: &mut crate::Value, - _timed_recovery_delay_in_minutes: &mut crate::Value + _controlled_asset: &mut crate::model::value::ast::ManifestAstValue, + _rule_set: &mut crate::model::value::ast::ManifestAstValue, + _timed_recovery_delay_in_minutes: &mut crate::model::value::ast::ManifestAstValue ), visit_create_identity( - _access_rule: &mut crate::Value + _access_rule: &mut crate::model::value::ast::ManifestAstValue ), visit_assert_access_rule( - _access_rule: &mut crate::Value + _access_rule: &mut crate::model::value::ast::ManifestAstValue ), visit_create_validator( - _key: &mut crate::Value, - _owner_access_rule: &mut crate::Value + _key: &mut crate::model::value::ast::ManifestAstValue, + _owner_access_rule: &mut crate::model::value::ast::ManifestAstValue + ), + + visit_create_account( + _withdraw_rule: &mut crate::model::value::ast::ManifestAstValue ), visit_clear_auth_zone(), - visit_drop_all_proofs() + visit_drop_all_proofs(), + visit_clear_signature_proofs(), + + post_visit() } } @@ -245,7 +249,7 @@ define_instruction_visitor! { /// the instruction visitors pub fn traverse_instruction( instruction: &mut Instruction, - value_visitors: &mut [&mut dyn ValueVisitor], + value_visitors: &mut [&mut dyn ManifestAstValueVisitor], instructions_visitors: &mut [&mut dyn InstructionVisitor], ) -> Result<()> { match instruction { @@ -474,7 +478,7 @@ pub fn traverse_instruction( Instruction::PublishPackage { code, - abi, + schema: abi, royalty_config, metadata, access_rules, @@ -495,23 +499,6 @@ pub fn traverse_instruction( )?; } - Instruction::PublishPackageWithOwner { - code, - abi, - owner_badge, - } => { - traverse_value(code, value_visitors)?; - traverse_value(abi, value_visitors)?; - traverse_value(owner_badge, value_visitors)?; - visit!( - instructions_visitors, - visit_publish_package_with_owner, - code, - abi, - owner_badge - )?; - } - Instruction::BurnResource { bucket } => { traverse_value(bucket, value_visitors)?; visit!(instructions_visitors, visit_burn_resource, bucket)?; @@ -545,6 +532,20 @@ pub fn traverse_instruction( )?; } + Instruction::RemoveMetadata { + entity_address, + key, + } => { + traverse_value(entity_address, value_visitors)?; + traverse_value(key, value_visitors)?; + visit!( + instructions_visitors, + visit_remove_metadata, + entity_address, + key + )?; + } + Instruction::SetPackageRoyaltyConfig { package_address, royalty_config, @@ -593,19 +594,16 @@ pub fn traverse_instruction( Instruction::SetMethodAccessRule { entity_address, - index, key, rule, } => { traverse_value(entity_address, value_visitors)?; - traverse_value(index, value_visitors)?; traverse_value(key, value_visitors)?; traverse_value(rule, value_visitors)?; visit!( instructions_visitors, visit_set_method_access_rule, entity_address, - index, key, rule )?; @@ -657,101 +655,95 @@ pub fn traverse_instruction( divisibility, metadata, access_rules, - initial_supply, } => { traverse_value(divisibility, value_visitors)?; traverse_value(metadata, value_visitors)?; traverse_value(access_rules, value_visitors)?; - traverse_value(initial_supply, value_visitors)?; visit!( instructions_visitors, visit_create_fungible_resource, divisibility, metadata, - access_rules, - initial_supply + access_rules )?; } - Instruction::CreateFungibleResourceWithOwner { + Instruction::CreateFungibleResourceWithInitialSupply { divisibility, metadata, - owner_badge, + access_rules, initial_supply, } => { traverse_value(divisibility, value_visitors)?; traverse_value(metadata, value_visitors)?; - traverse_value(owner_badge, value_visitors)?; + traverse_value(access_rules, value_visitors)?; traverse_value(initial_supply, value_visitors)?; visit!( instructions_visitors, visit_create_fungible_resource_with_owner, divisibility, metadata, - owner_badge, + access_rules, initial_supply )?; } Instruction::CreateNonFungibleResource { id_type, + schema, metadata, access_rules, - initial_supply, } => { traverse_value(id_type, value_visitors)?; + traverse_value(schema, value_visitors)?; traverse_value(metadata, value_visitors)?; traverse_value(access_rules, value_visitors)?; - traverse_value(initial_supply, value_visitors)?; visit!( instructions_visitors, visit_create_non_fungible_resource, id_type, + schema, metadata, - access_rules, - initial_supply + access_rules )?; } - Instruction::CreateNonFungibleResourceWithOwner { + Instruction::CreateNonFungibleResourceWithInitialSupply { id_type, + schema, metadata, - owner_badge, + access_rules, initial_supply, } => { traverse_value(id_type, value_visitors)?; + traverse_value(schema, value_visitors)?; traverse_value(metadata, value_visitors)?; - traverse_value(owner_badge, value_visitors)?; + traverse_value(access_rules, value_visitors)?; traverse_value(initial_supply, value_visitors)?; visit!( instructions_visitors, visit_create_non_fungible_resource_with_owner, id_type, + schema, metadata, - owner_badge, + access_rules, initial_supply )?; } Instruction::CreateAccessController { controlled_asset, - primary_role, - recovery_role, - confirmation_role, + rule_set, timed_recovery_delay_in_minutes, } => { traverse_value(controlled_asset, value_visitors)?; - traverse_value(primary_role, value_visitors)?; - traverse_value(recovery_role, value_visitors)?; - traverse_value(confirmation_role, value_visitors)?; + traverse_value(rule_set, value_visitors)?; traverse_value(timed_recovery_delay_in_minutes, value_visitors)?; visit!( instructions_visitors, visit_create_access_controller, controlled_asset, - primary_role, - recovery_role, - confirmation_role, + rule_set, timed_recovery_delay_in_minutes )?; } @@ -780,12 +772,21 @@ pub fn traverse_instruction( )?; } + Instruction::CreateAccount { withdraw_rule } => { + traverse_value(withdraw_rule, value_visitors)?; + visit!(instructions_visitors, visit_create_account, withdraw_rule)?; + } + Instruction::DropAllProofs => { visit!(instructions_visitors, visit_drop_all_proofs,)?; } + Instruction::ClearSignatureProofs => { + visit!(instructions_visitors, visit_clear_signature_proofs,)?; + } Instruction::ClearAuthZone => { visit!(instructions_visitors, visit_clear_auth_zone,)?; } }; + visit!(instructions_visitors, post_visit,)?; Ok(()) } diff --git a/radix-engine-toolkit/src/visitor/instruction/mod.rs b/radix-engine-toolkit/src/visitor/instruction/mod.rs index dbe07997..af8111b8 100644 --- a/radix-engine-toolkit/src/visitor/instruction/mod.rs +++ b/radix-engine-toolkit/src/visitor/instruction/mod.rs @@ -1,5 +1,13 @@ +#[cfg(feature = "radix-engine")] +pub mod account_deposits_visitor; pub mod account_interactions_visitor; +pub mod account_proofs_visitor; +pub mod account_withdraws_visitor; pub mod instruction_visitor; +#[cfg(feature = "radix-engine")] +pub use account_deposits_visitor::*; pub use account_interactions_visitor::*; +pub use account_proofs_visitor::*; +pub use account_withdraws_visitor::*; pub use instruction_visitor::*; diff --git a/radix-engine-toolkit/src/visitor/value/address_aggregator_visitor.rs b/radix-engine-toolkit/src/visitor/value/address_aggregator_visitor.rs index 1ebcfb0d..1b0eb3f9 100644 --- a/radix-engine-toolkit/src/visitor/value/address_aggregator_visitor.rs +++ b/radix-engine-toolkit/src/visitor/value/address_aggregator_visitor.rs @@ -1,59 +1,70 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + use std::collections::BTreeSet; -use crate::{ - NetworkAwareComponentAddress, NetworkAwarePackageAddress, NetworkAwareResourceAddress, Value, - ValueVisitor, +use crate::error::{Error, Result}; +use crate::model::address::{ + EntityAddress, NetworkAwareComponentAddress, NetworkAwarePackageAddress, + NetworkAwareResourceAddress, }; +use crate::model::value::ast::ManifestAstValue; +use crate::visitor::ManifestAstValueVisitor; /// An address aggregator visitor which collects all of the encountered global entity addresses and /// stored them in its state. #[derive(Debug, Default)] -pub struct AddressValueAggregator { +pub struct AddressAggregatorVisitor { pub component_addresses: BTreeSet, pub resource_addresses: BTreeSet, pub package_addresses: BTreeSet, } -impl ValueVisitor for AddressValueAggregator { - fn visit_component_address(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::ComponentAddress { address } = value { - self.component_addresses.insert(*address); +impl ManifestAstValueVisitor for AddressAggregatorVisitor { + fn visit_address(&mut self, value: &mut ManifestAstValue) -> Result<()> { + if let ManifestAstValue::Address { address } = value { + match address { + EntityAddress::ComponentAddress { address } => { + self.component_addresses.insert(*address); + } + EntityAddress::ResourceAddress { address } => { + self.resource_addresses.insert(*address); + } + EntityAddress::PackageAddress { address } => { + self.package_addresses.insert(*address); + } + } Ok(()) } else { - Err(crate::Error::Infallible { + Err(Error::Infallible { message: "Expected component address!".into(), }) } } - fn visit_resource_address(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::ResourceAddress { address } = value { - self.resource_addresses.insert(*address); - Ok(()) - } else { - Err(crate::Error::Infallible { - message: "Expected resource address!".into(), - }) - } - } - - fn visit_package_address(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::PackageAddress { address } = value { - self.package_addresses.insert(*address); - Ok(()) - } else { - Err(crate::Error::Infallible { - message: "Expected package address!".into(), - }) - } - } - - fn visit_non_fungible_global_id(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::NonFungibleGlobalId { address } = value { - self.resource_addresses.insert(address.resource_address); + fn visit_non_fungible_global_id(&mut self, value: &mut ManifestAstValue) -> Result<()> { + if let ManifestAstValue::NonFungibleGlobalId { + resource_address, .. + } = value + { + self.resource_addresses.insert(*resource_address); Ok(()) } else { - Err(crate::Error::Infallible { + Err(Error::Infallible { message: "Expected non-fungible global id!".into(), }) } diff --git a/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs b/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs index 769a9abb..09db8824 100644 --- a/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs +++ b/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs @@ -1,32 +1,49 @@ -use super::ValueVisitor; -use crate::error::Error; -use crate::model::{NonFungibleGlobalId, Value}; -use crate::ValueKind; +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +use crate::error::Error; +use crate::model::address::EntityAddress; +use crate::model::value::ast::{ManifestAstValue, ManifestAstValueKind}; +use crate::visitor::ManifestAstValueVisitor; /// A value visitor whose main responsibility is to perform aliasing on all encountered values. As /// an example, this is the main visitor responsible for turing a Tuple(ResourceAddress, NFLocalId) /// to a NonFungibleGlobalAddress #[derive(Debug, Default)] pub struct ValueAliasingVisitor; -impl ValueVisitor for ValueAliasingVisitor { - fn visit_tuple(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::Tuple { ref elements } = value { +impl ManifestAstValueVisitor for ValueAliasingVisitor { + fn visit_tuple(&mut self, value: &mut ManifestAstValue) -> crate::error::Result<()> { + if let ManifestAstValue::Tuple { ref elements } = value { // Case: NonFungibleGlobalId - A tuple of ResourceAddress and NonFungibleLocalId match (elements.get(0), elements.get(1)) { ( - Some(Value::ResourceAddress { - address: resource_address, + Some(ManifestAstValue::Address { + address: + EntityAddress::ResourceAddress { + address: resource_address, + }, }), - Some(Value::NonFungibleLocalId { + Some(ManifestAstValue::NonFungibleLocalId { value: non_fungible_local_id, }), ) if elements.len() == 2 => { - *value = Value::NonFungibleGlobalId { - address: NonFungibleGlobalId { - resource_address: *resource_address, - non_fungible_local_id: non_fungible_local_id.clone(), - }, + *value = ManifestAstValue::NonFungibleGlobalId { + resource_address: *resource_address, + non_fungible_local_id: non_fungible_local_id.clone(), }; Ok(()) } @@ -39,25 +56,25 @@ impl ValueVisitor for ValueAliasingVisitor { } } - fn visit_array(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::Array { + fn visit_array(&mut self, value: &mut ManifestAstValue) -> crate::error::Result<()> { + if let ManifestAstValue::Array { ref elements, - element_kind: ValueKind::U8, + element_kind: ManifestAstValueKind::U8, } = value { // Case: Bytes - An array of u8 let mut bytes = Vec::new(); for element in elements.iter() { match element { - Value::U8 { value } => bytes.push(*value), + ManifestAstValue::U8 { value } => bytes.push(*value), // If we encounter anything that is not a U8, then we stop the aliasing op and // don't continue. _ => return Ok(()), } } - *value = Value::Bytes { value: bytes }; + *value = ManifestAstValue::Bytes { value: bytes }; Ok(()) - } else if let Value::Array { .. } = value { + } else if let ManifestAstValue::Array { .. } = value { Ok(()) } else { Err(Error::Infallible { diff --git a/radix-engine-toolkit/src/visitor/value/mod.rs b/radix-engine-toolkit/src/visitor/value/mod.rs index 38ce310f..bed1b2ce 100644 --- a/radix-engine-toolkit/src/visitor/value/mod.rs +++ b/radix-engine-toolkit/src/visitor/value/mod.rs @@ -1,3 +1,20 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + pub mod address_aggregator_visitor; pub mod aliasing_visitor; pub mod network_aggregator_visitor; diff --git a/radix-engine-toolkit/src/visitor/value/network_aggregator_visitor.rs b/radix-engine-toolkit/src/visitor/value/network_aggregator_visitor.rs index fe63e602..b9245427 100644 --- a/radix-engine-toolkit/src/visitor/value/network_aggregator_visitor.rs +++ b/radix-engine-toolkit/src/visitor/value/network_aggregator_visitor.rs @@ -1,6 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + use std::collections::BTreeSet; -use crate::{Value, ValueVisitor}; +use crate::error::Error; +use crate::model::address::NetworkAwareResourceAddress; +use crate::model::value::ast::ManifestAstValue; +use crate::visitor::ManifestAstValueVisitor; /// A value visitor whose main job is to find all of the different network IDs that the different /// addresses use. This is typically used in operations where we wish to check for network id @@ -8,47 +28,35 @@ use crate::{Value, ValueVisitor}; #[derive(Debug, Default)] pub struct ValueNetworkAggregatorVisitor(pub BTreeSet); -impl ValueVisitor for ValueNetworkAggregatorVisitor { - fn visit_component_address(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::ComponentAddress { address } = value { - self.0.insert(address.network_id); - Ok(()) - } else { - Err(crate::Error::Infallible { - message: "Expected component address!".into(), - }) - } - } - - fn visit_resource_address(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::ResourceAddress { address } = value { - self.0.insert(address.network_id); +impl ManifestAstValueVisitor for ValueNetworkAggregatorVisitor { + fn visit_non_fungible_global_id( + &mut self, + value: &mut crate::model::value::ast::ManifestAstValue, + ) -> crate::error::Result<()> { + if let ManifestAstValue::NonFungibleGlobalId { + resource_address: NetworkAwareResourceAddress { network_id, .. }, + .. + } = value + { + self.0.insert(*network_id); Ok(()) } else { - Err(crate::Error::Infallible { - message: "Expected resource address!".into(), - }) - } - } - - fn visit_package_address(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::PackageAddress { address } = value { - self.0.insert(address.network_id); - Ok(()) - } else { - Err(crate::Error::Infallible { - message: "Expected package address!".into(), + Err(Error::Infallible { + message: "Expected non-fungible global id!".into(), }) } } - fn visit_non_fungible_global_id(&mut self, value: &mut crate::Value) -> crate::Result<()> { - if let Value::NonFungibleGlobalId { address } = value { - self.0.insert(address.resource_address.network_id); + fn visit_address( + &mut self, + value: &mut crate::model::value::ast::ManifestAstValue, + ) -> crate::error::Result<()> { + if let ManifestAstValue::Address { address } = value { + self.0.insert(address.network_id()); Ok(()) } else { - Err(crate::Error::Infallible { - message: "Expected non-fungible global id!".into(), + Err(Error::Infallible { + message: "Expected an address".into(), }) } } diff --git a/radix-engine-toolkit/src/visitor/value/value_visitor.rs b/radix-engine-toolkit/src/visitor/value/value_visitor.rs index 58cf6afb..9bc415b2 100644 --- a/radix-engine-toolkit/src/visitor/value/value_visitor.rs +++ b/radix-engine-toolkit/src/visitor/value/value_visitor.rs @@ -1,4 +1,21 @@ -use crate::{Value, ValueKind}; +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use crate::model::value::ast::{ManifestAstValue, ManifestAstValueKind}; macro_rules! define_value_visitor { ( @@ -10,7 +27,7 @@ macro_rules! define_value_visitor { $(#[$meta])* $vis trait $trait_ident { $( - fn $method_ident(&mut self, _value: &mut $crate::Value) -> $crate::Result<()> { + fn $method_ident(&mut self, _value: &mut $crate::model::value::ast::ManifestAstValue) -> $crate::error::Result<()> { Ok(()) } )* @@ -23,15 +40,15 @@ macro_rules! visit { $visitors .iter_mut() .map(|visitor| visitor.$method($value)) - .collect::<$crate::Result>>() + .collect::<$crate::error::Result>>() }; } define_value_visitor! { - /// A trait which defines a [`crate::Value`] visitor which operates on unstructured values, this + /// A trait which defines a [`crate::model::value::ast::ManifestAstValue`] visitor which operates on unstructured values, this /// choice is made to allow the visitor to work with aliasing an dealiasing operations which /// involves the visitor changing the value variant. - pub trait ValueVisitor { + pub trait ManifestAstValueVisitor { visit_bool, visit_u8, @@ -61,17 +78,7 @@ define_value_visitor! { visit_decimal, visit_precise_decimal, - visit_own, - - visit_component_address, - visit_resource_address, - visit_package_address, - - visit_hash, - visit_ecdsa_secp256k1_public_key, - visit_ecdsa_secp256k1_signature, - visit_eddsa_ed25519_public_key, - visit_eddsa_ed25519_signature, + visit_address, visit_bucket, visit_proof, @@ -86,133 +93,114 @@ define_value_visitor! { } pub fn traverse_value( - value: &mut crate::Value, - visitors: &mut [&mut dyn ValueVisitor], -) -> crate::Result<()> { + value: &mut crate::model::value::ast::ManifestAstValue, + visitors: &mut [&mut dyn ManifestAstValueVisitor], +) -> crate::error::Result<()> { // Visit the top level value parts match value.kind() { - ValueKind::Bool => visit!(visitors, visit_bool, value)?, - - ValueKind::U8 => visit!(visitors, visit_u8, value)?, - ValueKind::U16 => visit!(visitors, visit_u16, value)?, - ValueKind::U32 => visit!(visitors, visit_u32, value)?, - ValueKind::U64 => visit!(visitors, visit_u64, value)?, - ValueKind::U128 => visit!(visitors, visit_u128, value)?, + ManifestAstValueKind::Bool => visit!(visitors, visit_bool, value)?, - ValueKind::I8 => visit!(visitors, visit_i8, value)?, - ValueKind::I16 => visit!(visitors, visit_i16, value)?, - ValueKind::I32 => visit!(visitors, visit_i32, value)?, - ValueKind::I64 => visit!(visitors, visit_i64, value)?, - ValueKind::I128 => visit!(visitors, visit_i128, value)?, + ManifestAstValueKind::U8 => visit!(visitors, visit_u8, value)?, + ManifestAstValueKind::U16 => visit!(visitors, visit_u16, value)?, + ManifestAstValueKind::U32 => visit!(visitors, visit_u32, value)?, + ManifestAstValueKind::U64 => visit!(visitors, visit_u64, value)?, + ManifestAstValueKind::U128 => visit!(visitors, visit_u128, value)?, - ValueKind::String => visit!(visitors, visit_string, value)?, + ManifestAstValueKind::I8 => visit!(visitors, visit_i8, value)?, + ManifestAstValueKind::I16 => visit!(visitors, visit_i16, value)?, + ManifestAstValueKind::I32 => visit!(visitors, visit_i32, value)?, + ManifestAstValueKind::I64 => visit!(visitors, visit_i64, value)?, + ManifestAstValueKind::I128 => visit!(visitors, visit_i128, value)?, - ValueKind::Enum => visit!(visitors, visit_enum, value)?, + ManifestAstValueKind::String => visit!(visitors, visit_string, value)?, - ValueKind::Some => visit!(visitors, visit_some, value)?, - ValueKind::None => visit!(visitors, visit_none, value)?, - ValueKind::Ok => visit!(visitors, visit_ok, value)?, - ValueKind::Err => visit!(visitors, visit_err, value)?, + ManifestAstValueKind::Enum => visit!(visitors, visit_enum, value)?, - ValueKind::Map => visit!(visitors, visit_map, value)?, - ValueKind::Array => visit!(visitors, visit_array, value)?, - ValueKind::Tuple => visit!(visitors, visit_tuple, value)?, + ManifestAstValueKind::Some => visit!(visitors, visit_some, value)?, + ManifestAstValueKind::None => visit!(visitors, visit_none, value)?, + ManifestAstValueKind::Ok => visit!(visitors, visit_ok, value)?, + ManifestAstValueKind::Err => visit!(visitors, visit_err, value)?, - ValueKind::Decimal => visit!(visitors, visit_decimal, value)?, - ValueKind::PreciseDecimal => visit!(visitors, visit_precise_decimal, value)?, + ManifestAstValueKind::Map => visit!(visitors, visit_map, value)?, + ManifestAstValueKind::Array => visit!(visitors, visit_array, value)?, + ManifestAstValueKind::Tuple => visit!(visitors, visit_tuple, value)?, - ValueKind::Own => visit!(visitors, visit_own, value)?, + ManifestAstValueKind::Decimal => visit!(visitors, visit_decimal, value)?, + ManifestAstValueKind::PreciseDecimal => visit!(visitors, visit_precise_decimal, value)?, - ValueKind::ComponentAddress => visit!(visitors, visit_component_address, value)?, - ValueKind::ResourceAddress => visit!(visitors, visit_resource_address, value)?, - ValueKind::PackageAddress => visit!(visitors, visit_package_address, value)?, + ManifestAstValueKind::Address => visit!(visitors, visit_address, value)?, - ValueKind::Hash => visit!(visitors, visit_hash, value)?, + ManifestAstValueKind::Bucket => visit!(visitors, visit_bucket, value)?, + ManifestAstValueKind::Proof => visit!(visitors, visit_proof, value)?, - ValueKind::EcdsaSecp256k1PublicKey => { - visit!(visitors, visit_ecdsa_secp256k1_public_key, value)? + ManifestAstValueKind::NonFungibleLocalId => { + visit!(visitors, visit_non_fungible_local_id, value)? } - ValueKind::EcdsaSecp256k1Signature => { - visit!(visitors, visit_ecdsa_secp256k1_signature, value)? + ManifestAstValueKind::NonFungibleGlobalId => { + visit!(visitors, visit_non_fungible_global_id, value)? } - ValueKind::EddsaEd25519PublicKey => { - visit!(visitors, visit_eddsa_ed25519_public_key, value)? - } - ValueKind::EddsaEd25519Signature => visit!(visitors, visit_eddsa_ed25519_signature, value)?, - - ValueKind::Bucket => visit!(visitors, visit_bucket, value)?, - ValueKind::Proof => visit!(visitors, visit_proof, value)?, - - ValueKind::NonFungibleLocalId => visit!(visitors, visit_non_fungible_local_id, value)?, - ValueKind::NonFungibleGlobalId => visit!(visitors, visit_non_fungible_global_id, value)?, - ValueKind::Expression => visit!(visitors, visit_expression, value)?, - ValueKind::Blob => visit!(visitors, visit_blob, value)?, - ValueKind::Bytes => visit!(visitors, visit_bytes, value)?, + ManifestAstValueKind::Expression => visit!(visitors, visit_expression, value)?, + ManifestAstValueKind::Blob => visit!(visitors, visit_blob, value)?, + ManifestAstValueKind::Bytes => visit!(visitors, visit_bytes, value)?, }; // Attempt to continue traversal on the value children (contained nested values). For future - // reference, any variant that has a `Value` inside of it should go here. + // reference, any variant that has a `ManifestAstValue` inside of it should go here. match value { - Value::Map { + ManifestAstValue::Map { entries: values, .. } => { values .iter_mut() .flat_map(|(x, y)| [x, y]) .map(|value| traverse_value(value, visitors)) - .collect::>>()?; + .collect::>>()?; } - Value::Enum { + ManifestAstValue::Enum { fields: Some(values), .. } - | Value::Array { + | ManifestAstValue::Array { elements: values, .. } - | Value::Tuple { + | ManifestAstValue::Tuple { elements: values, .. } => { values .iter_mut() .map(|value| traverse_value(value, visitors)) - .collect::>>()?; + .collect::>>()?; } - Value::Some { value } | Value::Ok { value } | Value::Err { value } => { + ManifestAstValue::Some { value } + | ManifestAstValue::Ok { value } + | ManifestAstValue::Err { value } => { traverse_value(value, visitors)?; } - Value::Bool { .. } - | Value::U8 { .. } - | Value::U16 { .. } - | Value::U32 { .. } - | Value::U64 { .. } - | Value::U128 { .. } - | Value::I8 { .. } - | Value::I16 { .. } - | Value::I32 { .. } - | Value::I64 { .. } - | Value::I128 { .. } - | Value::String { .. } - | Value::Enum { fields: None, .. } - | Value::None { .. } - | Value::Decimal { .. } - | Value::PreciseDecimal { .. } - | Value::Own { .. } - | Value::ComponentAddress { .. } - | Value::ResourceAddress { .. } - | Value::PackageAddress { .. } - | Value::Hash { .. } - | Value::EcdsaSecp256k1PublicKey { .. } - | Value::EcdsaSecp256k1Signature { .. } - | Value::EddsaEd25519PublicKey { .. } - | Value::EddsaEd25519Signature { .. } - | Value::Bucket { .. } - | Value::Proof { .. } - | Value::NonFungibleLocalId { .. } - | Value::NonFungibleGlobalId { .. } - | Value::Expression { .. } - | Value::Blob { .. } - | Value::Bytes { .. } => { /* No OP. Doesn't contain a Value */ } + ManifestAstValue::Bool { .. } + | ManifestAstValue::U8 { .. } + | ManifestAstValue::U16 { .. } + | ManifestAstValue::U32 { .. } + | ManifestAstValue::U64 { .. } + | ManifestAstValue::U128 { .. } + | ManifestAstValue::I8 { .. } + | ManifestAstValue::I16 { .. } + | ManifestAstValue::I32 { .. } + | ManifestAstValue::I64 { .. } + | ManifestAstValue::I128 { .. } + | ManifestAstValue::String { .. } + | ManifestAstValue::Enum { fields: None, .. } + | ManifestAstValue::None { .. } + | ManifestAstValue::Decimal { .. } + | ManifestAstValue::PreciseDecimal { .. } + | ManifestAstValue::Address { .. } + | ManifestAstValue::Bucket { .. } + | ManifestAstValue::Proof { .. } + | ManifestAstValue::NonFungibleLocalId { .. } + | ManifestAstValue::NonFungibleGlobalId { .. } + | ManifestAstValue::Expression { .. } + | ManifestAstValue::Blob { .. } + | ManifestAstValue::Bytes { .. } => { /* No OP. Doesn't contain a ManifestAstValue */ } }; Ok(()) diff --git a/radix-engine-toolkit/tests/aliasing.rs b/radix-engine-toolkit/tests/aliasing.rs index 949fb480..f5493ff1 100644 --- a/radix-engine-toolkit/tests/aliasing.rs +++ b/radix-engine-toolkit/tests/aliasing.rs @@ -1,44 +1,60 @@ -use radix_engine_toolkit::{ - model::Value, traverse_value, NonFungibleGlobalId, ValueAliasingVisitor, ValueKind, -}; +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use radix_engine_toolkit::model::value::ast::{ManifestAstValue, ManifestAstValueKind}; +use radix_engine_toolkit::visitor::{traverse_value, ValueAliasingVisitor}; use scrypto::prelude::IntegerNonFungibleLocalId; #[test] fn aliasing_of_deeply_nested_structures_works() { // Arrange - let mut value = Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::Tuple, + let mut value = ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::Tuple, entries: vec![ ( - Value::String { + ManifestAstValue::String { value: "HelloWorld".into(), }, - Value::Tuple { + ManifestAstValue::Tuple { elements: vec![ - Value::Decimal { + ManifestAstValue::Decimal { value: "12".parse().unwrap(), }, - Value::PreciseDecimal { + ManifestAstValue::PreciseDecimal { value: "12".parse().unwrap(), }, ], }, ), ( - Value::String { + ManifestAstValue::String { value: "WorldHello".into(), }, - Value::Tuple { - elements: vec![Value::Tuple { - elements: vec![Value::Tuple { - elements: vec![Value::Array { - element_kind: ValueKind::Array, - elements: vec![Value::Array { - element_kind: ValueKind::Tuple, - elements: vec![Value::Tuple { elements: vec![ - Value::ResourceAddress { address: "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety".parse().unwrap() }, - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)) } , + ManifestAstValue::Tuple { + elements: vec![ManifestAstValue::Tuple { + elements: vec![ManifestAstValue::Tuple { + elements: vec![ManifestAstValue::Array { + element_kind: ManifestAstValueKind::Array, + elements: vec![ManifestAstValue::Array { + element_kind: ManifestAstValueKind::Tuple, + elements: vec![ManifestAstValue::Tuple { elements: vec![ + ManifestAstValue::Address { address: "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k".parse().unwrap() }, + ManifestAstValue::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)) } , ] }], }], }], @@ -49,40 +65,40 @@ fn aliasing_of_deeply_nested_structures_works() { ], }; - let expected = Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::Tuple, + let expected = ManifestAstValue::Map { + key_value_kind: ManifestAstValueKind::String, + value_value_kind: ManifestAstValueKind::Tuple, entries: vec![ ( - Value::String { + ManifestAstValue::String { value: "HelloWorld".into(), }, - Value::Tuple { + ManifestAstValue::Tuple { elements: vec![ - Value::Decimal { + ManifestAstValue::Decimal { value: "12".parse().unwrap(), }, - Value::PreciseDecimal { + ManifestAstValue::PreciseDecimal { value: "12".parse().unwrap(), }, ], }, ), ( - Value::String { + ManifestAstValue::String { value: "WorldHello".into(), }, - Value::Tuple { - elements: vec![Value::Tuple { - elements: vec![Value::Tuple { - elements: vec![Value::Array { - element_kind: ValueKind::Array, - elements: vec![Value::Array { - element_kind: ValueKind::Tuple, - elements: vec![Value::NonFungibleGlobalId { address: NonFungibleGlobalId { - resource_address: "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety".parse().unwrap(), + ManifestAstValue::Tuple { + elements: vec![ManifestAstValue::Tuple { + elements: vec![ManifestAstValue::Tuple { + elements: vec![ManifestAstValue::Array { + element_kind: ManifestAstValueKind::Array, + elements: vec![ManifestAstValue::Array { + element_kind: ManifestAstValueKind::Tuple, + elements: vec![ManifestAstValue::NonFungibleGlobalId { + resource_address: "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k".parse().unwrap(), non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)) - } }], + }], }], }], }], diff --git a/radix-engine-toolkit/tests/common_manifests.rs b/radix-engine-toolkit/tests/common_manifests.rs index a08c0701..696ac480 100644 --- a/radix-engine-toolkit/tests/common_manifests.rs +++ b/radix-engine-toolkit/tests/common_manifests.rs @@ -1,9 +1,26 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + use std::path::{Path, PathBuf}; -use radix_engine_toolkit::{ - ConvertManifestHandler, ConvertManifestRequest, Handler, InstructionKind, InstructionList, - TransactionManifest, +use radix_engine_toolkit::model::transaction::{ + InstructionKind, InstructionList, TransactionManifest, }; +use radix_engine_toolkit::request::{ConvertManifestHandler, ConvertManifestRequest, Handler}; const MANIFESTS_PATH: &str = "./tests/test_vector/manifest"; @@ -11,7 +28,7 @@ const MANIFESTS_PATH: &str = "./tests/test_vector/manifest"; pub fn common_manifests_can_be_converted_to_parsed_manifests() { // Arrange for file_path in rtm_file_paths(MANIFESTS_PATH) { - let manifest_str = std::fs::read_to_string(file_path) + let manifest_str = std::fs::read_to_string(&file_path) .map(manifest_replace) .unwrap(); @@ -38,13 +55,13 @@ pub fn common_manifests_can_be_converted_to_parsed_manifests() { pub fn common_manifests_can_be_converted_to_parsed_and_then_back_to_string_manifests() { // Arrange for file_path in rtm_file_paths(MANIFESTS_PATH) { - let manifest_str = std::fs::read_to_string(file_path) + let manifest_str = std::fs::read_to_string(&file_path) .map(manifest_replace) .unwrap(); let manifest = TransactionManifest { instructions: InstructionList::String(manifest_str), - blobs: vec![[10].into(), [10].into()], + blobs: vec![[10].into()], }; let request = ConvertManifestRequest { @@ -73,61 +90,61 @@ fn manifest_replace(string: String) -> String { .replace("${", "{") .replace( "{xrd_resource_address}", - "resource_sim1qzkcyv5dwq3r6kawy6pxpvcythx8rh8ntum6ws62p95sqjjpwr", + "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", ) .replace( "{faucet_component_address}", - "component_sim1qftacppvmr9ezmekxqpq58en0nk954x0a7jv2zz0hc7q8utaxr", + "component_sim1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0tshjs68x", ) .replace( "{this_account_component_address}", - "account_sim1qwskd4q5jdywfw6f7jlwmcyp2xxq48uuwruc003x2kcskxh3na", + "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", ) .replace( "{account_component_address}", - "account_sim1qwskd4q5jdywfw6f7jlwmcyp2xxq48uuwruc003x2kcskxh3na", + "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", ) .replace( "{other_account_component_address}", - "account_sim1qdy4jqfpehf8nv4n7680cw0vhxqvhgh5lf3ae8jkjz6q5hmzed", + "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", ) .replace( "{account_a_component_address}", - "account_sim1qwssydet6r0wen92wzs3nex8x9ch5ye0uz9tzgq5nchq86xmpm", + "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", ) .replace( "{account_b_component_address}", - "account_sim1qdxpdrpjtsqmumccye045u4cfw2fqa3a9gujh6qvdresgnl2nh", + "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", ) .replace( "{account_c_component_address}", - "account_sim1qd4jtjgqxtmk2m7ze0cpa6ugae8jwfhgxqenvw6m6uwqgqmp4q", + "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", ) .replace( "{owner_badge_resource_address}", - "resource_sim1qrtkj5zx7tcpuhwjxerhhnmwv58k9v5yyjqgqt7rtnxsnqyl3s", + "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", ) .replace( "{minter_badge_resource_address}", - "resource_sim1qp075qmn6389pkq30ppzzsuadd55ry04mjx69v86r4wq0feh02", + "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", ) .replace( "{auth_badge_resource_address}", - "resource_sim1qp075qmn6389pkq30ppzzsuadd55ry04mjx69v86r4wq0feh02", + "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", ) .replace( "{mintable_resource_address}", - "resource_sim1qqgvpz8q7ypeueqcv4qthsv7ezt8h9m3depmqqw7pc4sfmucfx", + "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", ) .replace("{owner_badge_non_fungible_local_id}", "#1#") .replace("{auth_badge_non_fungible_local_id}", "#1#") .replace( "{code_blob_hash}", - "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "5b4b01a4a3892ea3751793da57f072ae08eec694ddcda872239fc8239e4bcd1b", ) .replace( - "{abi_blob_hash}", - "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "{schema_blob_hash}", + "5b4b01a4a3892ea3751793da57f072ae08eec694ddcda872239fc8239e4bcd1b", ) .replace("{initial_supply}", "12") .replace("{mint_amount}", "12") diff --git a/radix-engine-toolkit/tests/decompilation_tests.rs b/radix-engine-toolkit/tests/decompilation_tests.rs new file mode 100644 index 00000000..9f178a6e --- /dev/null +++ b/radix-engine-toolkit/tests/decompilation_tests.rs @@ -0,0 +1,201 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use native_transaction::builder::{ManifestBuilder, TransactionBuilder}; +use native_transaction::ecdsa_secp256k1::EcdsaSecp256k1PrivateKey; +use native_transaction::model::{NotarizedTransaction, TransactionHeader}; +use radix_engine_common::ManifestSbor; +use radix_engine_constants::DEFAULT_COST_UNIT_LIMIT; +use radix_engine_toolkit::request::{ + CompileNotarizedTransactionHandler, CompileNotarizedTransactionRequest, + DecompileNotarizedTransactionHandler, DecompileNotarizedTransactionRequest, Handler, +}; +use scrypto::prelude::*; + +#[test] +fn decompilation_and_compilation_of_simple_transfer_succeeds() { + // Arrange + let private_key1 = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let private_key2 = EcdsaSecp256k1PrivateKey::from_u64(2).unwrap(); + + let account1 = ComponentAddress::virtual_account_from_public_key(&private_key1.public_key()); + let account2 = ComponentAddress::virtual_account_from_public_key(&private_key2.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account1, 10.into()) + .withdraw_from_account(account1, RADIX_TOKEN, 1.into()) + .call_method( + account2, + "deposit_batch", + manifest_args!(ManifestExpression::EntireWorktop), + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key1.public_key())) + .manifest(manifest) + .notarize(&private_key1) + .build(); + + // Act & Assert + test_inversion(&transaction); +} + +#[test] +fn decompilation_and_compilation_of_creating_a_simple_fungible_resource_succeeds() { + // Arrange + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let account = ComponentAddress::virtual_account_from_public_key(&private_key.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account, 10.into()) + .create_fungible_resource( + 18, + BTreeMap::new(), + BTreeMap::<_, (_, AccessRule)>::new(), + None, + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key.public_key())) + .manifest(manifest) + .notarize(&private_key) + .build(); + + // Act & Assert + test_inversion(&transaction); +} + +#[test] +fn decompilation_and_compilation_of_creating_a_simple_non_fungible_resource_succeeds() { + // Arrange + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let account = ComponentAddress::virtual_account_from_public_key(&private_key.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account, 10.into()) + .create_non_fungible_resource( + NonFungibleIdType::Integer, + BTreeMap::new(), + BTreeMap::<_, (_, AccessRule)>::new(), + None::>, + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key.public_key())) + .manifest(manifest) + .notarize(&private_key) + .build(); + + // Act & Assert + test_inversion(&transaction); +} + +#[test] +fn decompilation_and_compilation_of_creating_a_simple_non_fungible_resource_with_initial_supply_succeeds( +) { + // Arrange + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let account = ComponentAddress::virtual_account_from_public_key(&private_key.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account, 10.into()) + .create_non_fungible_resource( + NonFungibleIdType::Integer, + BTreeMap::new(), + BTreeMap::<_, (_, AccessRule)>::new(), + Some([( + NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + EmptyStruct {}, + )]), + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key.public_key())) + .manifest(manifest) + .notarize(&private_key) + .build(); + + // Act & Assert + test_inversion(&transaction); +} + +#[test] +fn decompilation_and_compilation_of_minting_non_fungible_tokens_succeeds() { + // Arrange + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let account = ComponentAddress::virtual_account_from_public_key(&private_key.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account, 10.into()) + .mint_non_fungible( + RADIX_TOKEN, + [( + NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + EmptyStruct {}, + )], + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key.public_key())) + .manifest(manifest) + .notarize(&private_key) + .build(); + + // Act & Assert + test_inversion(&transaction); +} + +fn header>(network_id: u8, notary_public_key: P) -> TransactionHeader { + TransactionHeader { + version: 0x01, + network_id, + start_epoch_inclusive: 10, + end_epoch_exclusive: 13, + nonce: 0x02, + notary_public_key: notary_public_key.into(), + notary_as_signatory: true, + cost_unit_limit: DEFAULT_COST_UNIT_LIMIT, + tip_percentage: 0, + } +} + +fn test_inversion(transaction: &NotarizedTransaction) { + let native_compiled = manifest_encode(&transaction).unwrap(); + let compiled_from_decompiled = { + let request = DecompileNotarizedTransactionRequest { + compiled_notarized_intent: native_compiled.clone(), + instructions_output_kind: + radix_engine_toolkit::model::transaction::InstructionKind::String, + }; + let response = DecompileNotarizedTransactionHandler::fulfill(request).unwrap(); + + let request = CompileNotarizedTransactionRequest { + notarized_intent: response.notarized_intent, + }; + let response = CompileNotarizedTransactionHandler::fulfill(request).unwrap(); + response.compiled_intent + }; + assert_eq!(native_compiled, compiled_from_decompiled) +} + +#[derive(ScryptoSbor, NonFungibleData, ManifestSbor)] +struct EmptyStruct {} diff --git a/radix-engine-toolkit/tests/derive_babylon_address_from_olympia_address.rs b/radix-engine-toolkit/tests/derive_babylon_address_from_olympia_address.rs new file mode 100644 index 00000000..4e456918 --- /dev/null +++ b/radix-engine-toolkit/tests/derive_babylon_address_from_olympia_address.rs @@ -0,0 +1,53 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use radix_engine_common::crypto::{EcdsaSecp256k1PublicKey, PublicKey}; +use radix_engine_common::data::scrypto::model::ComponentAddress; +use radix_engine_toolkit::request::{ + DeriveBabylonAddressFromOlympiaAddressHandler, DeriveBabylonAddressFromOlympiaAddressRequest, + Handler, +}; +use radix_engine_toolkit::utils::checked_copy_u8_slice; + +#[test] +pub fn deriving_babylon_address_from_olympia_address_succeeds_and_produces_expected_address() { + // Arrange + let olympia_address = "rdx1qspx7zxmnrh36q33av24srdfzg7m3cj65968erpjuh7ja3rm3kmn6hq4j9842"; + let expected_public_key = PublicKey::EcdsaSecp256k1(EcdsaSecp256k1PublicKey( + checked_copy_u8_slice( + hex::decode("026f08db98ef1d0231eb15580da9123db8e25aa1747c8c32e5fd2ec47b8db73d5c") + .unwrap(), + ) + .unwrap(), + )); + let expected_nebunet_address = + ComponentAddress::virtual_account_from_public_key(&expected_public_key); + + // Act + let (public_key, account_address) = { + let request = DeriveBabylonAddressFromOlympiaAddressRequest { + network_id: 0x0b, + olympia_account_address: olympia_address.to_owned(), + }; + let response = DeriveBabylonAddressFromOlympiaAddressHandler::fulfill(request).unwrap(); + (response.public_key, response.babylon_account_address) + }; + + // Assert + assert_eq!(expected_public_key, public_key); + assert_eq!(expected_nebunet_address, account_address.address); +} diff --git a/radix-engine-toolkit/tests/instruction.rs b/radix-engine-toolkit/tests/instruction.rs deleted file mode 100644 index 3ce45380..00000000 --- a/radix-engine-toolkit/tests/instruction.rs +++ /dev/null @@ -1,97 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 - -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -mod test_vector; - -use radix_engine_toolkit::model::{Bech32Coder, Instruction}; -use test_vector::*; - -#[test] -fn serialized_instructions_match_expected() { - // Checking that the serialization of instructions matches - for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { - // Act - let expected_serialized_instruction: serde_json::Value = - serde_json::from_str(&test_vector.json_representation) - .expect("Failed to deserialize trusted instruction"); - let serialized_instruction = serde_json::to_value(&test_vector.instruction) - .expect("Failed to serialize trusted instruction"); - - // Assert - assert_eq!(expected_serialized_instruction, serialized_instruction); - } -} - -#[test] -fn deserialized_instructions_match_expected() { - // Checking that the deserialization of instructions matches - for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { - // Act - let expected_instruction = &test_vector.instruction; - let deserialized_instruction = serde_json::from_str(&test_vector.json_representation) - .expect("Deserialization failed!"); - - // Assert - assert_eq!(*expected_instruction, deserialized_instruction) - } -} - -#[test] -fn instruction_ast_conversions_match_that_produced_by_transaction_compiler() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing - // the manifest - for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { - let expected_ast_instruction = test_vector.manifest_representation_as_ast_instruction(); - - // Act - let ast_instruction = test_vector - .instruction - .to_ast_instruction(&bech32_coder) - .expect("Instruction -> AstInstruction conversion of trusted instruction failed"); - - // Assert - assert_eq!(expected_ast_instruction, ast_instruction) - } -} - -#[test] -fn no_information_is_lost_when_converting_instruction_to_ast_instruction_and_back() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Instruction -> AstInstruction conversion matches that obtained from parsing - // the manifest - for test_vector in INSTRUCTION_CONVERSION_TEST_VECTORS.iter() { - let expected_instruction = &test_vector.instruction; - - // Act - let ast_instruction = Instruction::from_ast_instruction( - &test_vector - .instruction - .to_ast_instruction(&bech32_coder) - .expect("Instruction -> AstInstruction conversion of trusted instruction failed"), - &bech32_coder, - ) - .expect("AstInstruction -> Instruction for a trusted instruction failed"); - - // Assert - assert_eq!(*expected_instruction, ast_instruction) - } -} diff --git a/radix-engine-toolkit/tests/proofs_visitor.rs b/radix-engine-toolkit/tests/proofs_visitor.rs new file mode 100644 index 00000000..ea1ca7e4 --- /dev/null +++ b/radix-engine-toolkit/tests/proofs_visitor.rs @@ -0,0 +1,170 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use std::collections::BTreeSet; + +use native_transaction::{builder::ManifestBuilder, ecdsa_secp256k1::EcdsaSecp256k1PrivateKey}; +use radix_engine_toolkit::model::address::Bech32Coder; +use radix_engine_toolkit::model::transaction::{ + InstructionKind, InstructionList, TransactionManifest, +}; +use radix_engine_toolkit::visitor::{traverse_instruction, AccountProofsInstructionVisitor}; +use scrypto::prelude::{ + ComponentAddress, IntegerNonFungibleLocalId, NonFungibleLocalId, RADIX_TOKEN, +}; + +#[test] +fn account_create_proof_is_captured_by_visitor() { + // Arrange + let account = { + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let public_key = private_key.public_key(); + ComponentAddress::virtual_account_from_public_key(&public_key) + }; + + let mut instructions = { + let native_manifest = ManifestBuilder::new() + .create_proof_from_account(account, RADIX_TOKEN) + .build(); + let manifest = TransactionManifest::from_native_manifest( + &native_manifest, + InstructionKind::Parsed, + &Bech32Coder::new(0x01), + ) + .unwrap(); + + if let InstructionList::Parsed(instructions) = manifest.instructions { + instructions + } else { + panic!("Impossible case!") + } + }; + + let mut visitor = AccountProofsInstructionVisitor::default(); + + // Act + for instruction in instructions.iter_mut() { + traverse_instruction(instruction, &mut [], &mut [&mut visitor]).unwrap(); + } + + // Assert + assert_eq!( + BTreeSet::from([RADIX_TOKEN]), + visitor + .created_proofs + .into_iter() + .map(|item| item.address) + .collect() + ) +} + +#[test] +fn account_create_proof_by_amount_is_captured_by_visitor() { + // Arrange + let account = { + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let public_key = private_key.public_key(); + ComponentAddress::virtual_account_from_public_key(&public_key) + }; + + let mut instructions = { + let native_manifest = ManifestBuilder::new() + .create_proof_from_account_by_amount(account, RADIX_TOKEN, 1.into()) + .build(); + let manifest = TransactionManifest::from_native_manifest( + &native_manifest, + InstructionKind::Parsed, + &Bech32Coder::new(0x01), + ) + .unwrap(); + + if let InstructionList::Parsed(instructions) = manifest.instructions { + instructions + } else { + panic!("Impossible case!") + } + }; + + let mut visitor = AccountProofsInstructionVisitor::default(); + + // Act + for instruction in instructions.iter_mut() { + traverse_instruction(instruction, &mut [], &mut [&mut visitor]).unwrap(); + } + + // Assert + assert_eq!( + BTreeSet::from([RADIX_TOKEN]), + visitor + .created_proofs + .into_iter() + .map(|item| item.address) + .collect() + ) +} + +#[test] +fn account_create_proof_by_ids_is_captured_by_visitor() { + // Arrange + let account = { + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let public_key = private_key.public_key(); + ComponentAddress::virtual_account_from_public_key(&public_key) + }; + + let mut instructions = { + let native_manifest = ManifestBuilder::new() + .create_proof_from_account_by_ids( + account, + RADIX_TOKEN, + &[NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new( + 1, + ))] + .into(), + ) + .build(); + let manifest = TransactionManifest::from_native_manifest( + &native_manifest, + InstructionKind::Parsed, + &Bech32Coder::new(0x01), + ) + .unwrap(); + + if let InstructionList::Parsed(instructions) = manifest.instructions { + instructions + } else { + panic!("Impossible case!") + } + }; + + let mut visitor = AccountProofsInstructionVisitor::default(); + + // Act + for instruction in instructions.iter_mut() { + traverse_instruction(instruction, &mut [], &mut [&mut visitor]).unwrap(); + } + + // Assert + assert_eq!( + BTreeSet::from([RADIX_TOKEN]), + visitor + .created_proofs + .into_iter() + .map(|item| item.address) + .collect() + ) +} diff --git a/radix-engine-toolkit/tests/statically_validate_transaction_tests.rs b/radix-engine-toolkit/tests/statically_validate_transaction_tests.rs new file mode 100644 index 00000000..118dae04 --- /dev/null +++ b/radix-engine-toolkit/tests/statically_validate_transaction_tests.rs @@ -0,0 +1,243 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use native_transaction::builder::{ManifestBuilder, TransactionBuilder}; +use native_transaction::ecdsa_secp256k1::EcdsaSecp256k1PrivateKey; +use native_transaction::manifest::{compile, decompile}; +use native_transaction::model::{NotarizedTransaction, TransactionHeader}; +use native_transaction::validation::ValidationConfig; +use radix_engine_common::ManifestSbor; +use radix_engine_constants::DEFAULT_COST_UNIT_LIMIT; +use radix_engine_toolkit::request::{ + Handler, StaticallyValidateTransactionHandler, StaticallyValidateTransactionRequest, + StaticallyValidateTransactionResponse, +}; +use scrypto::prelude::*; + +#[test] +fn static_validation_of_simple_transfer_succeeds() { + // Arrange + let private_key1 = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let private_key2 = EcdsaSecp256k1PrivateKey::from_u64(2).unwrap(); + + let account1 = ComponentAddress::virtual_account_from_public_key(&private_key1.public_key()); + let account2 = ComponentAddress::virtual_account_from_public_key(&private_key2.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account1, 10.into()) + .withdraw_from_account(account1, RADIX_TOKEN, 1.into()) + .call_method( + account2, + "deposit_batch", + manifest_args!(ManifestExpression::EntireWorktop), + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key1.public_key())) + .manifest(manifest) + .notarize(&private_key1) + .build(); + + // Act + test_inversion(&transaction); + let validation_result = statically_validate(&transaction); + + // Assert + assert_eq!( + validation_result, + StaticallyValidateTransactionResponse::Valid + ); +} + +#[test] +fn static_validation_of_creating_a_simple_fungible_resource_succeeds() { + // Arrange + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let account = ComponentAddress::virtual_account_from_public_key(&private_key.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account, 10.into()) + .create_fungible_resource( + 18, + BTreeMap::new(), + BTreeMap::<_, (_, AccessRule)>::new(), + None, + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key.public_key())) + .manifest(manifest) + .notarize(&private_key) + .build(); + + // Act + test_inversion(&transaction); + let validation_result = statically_validate(&transaction); + + // Assert + assert_eq!( + validation_result, + StaticallyValidateTransactionResponse::Valid + ); +} + +#[test] +fn static_validation_of_creating_a_simple_non_fungible_resource_succeeds() { + // Arrange + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let account = ComponentAddress::virtual_account_from_public_key(&private_key.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account, 10.into()) + .create_non_fungible_resource( + NonFungibleIdType::Integer, + BTreeMap::new(), + BTreeMap::<_, (_, AccessRule)>::new(), + None::>, + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key.public_key())) + .manifest(manifest) + .notarize(&private_key) + .build(); + + // Act + test_inversion(&transaction); + let validation_result = statically_validate(&transaction); + + // Assert + assert_eq!( + validation_result, + StaticallyValidateTransactionResponse::Valid + ); +} + +#[test] +fn static_validation_of_creating_a_simple_non_fungible_resource_with_initial_supply_succeeds() { + // Arrange + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let account = ComponentAddress::virtual_account_from_public_key(&private_key.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account, 10.into()) + .create_non_fungible_resource( + NonFungibleIdType::Integer, + BTreeMap::new(), + BTreeMap::<_, (_, AccessRule)>::new(), + Some([( + NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + EmptyStruct {}, + )]), + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key.public_key())) + .manifest(manifest) + .notarize(&private_key) + .build(); + + // Act + test_inversion(&transaction); + let validation_result = statically_validate(&transaction); + + // Assert + assert_eq!( + validation_result, + StaticallyValidateTransactionResponse::Valid + ); +} + +#[test] +fn static_validation_of_minting_non_fungible_tokens_succeeds() { + // Arrange + let private_key = EcdsaSecp256k1PrivateKey::from_u64(1).unwrap(); + let account = ComponentAddress::virtual_account_from_public_key(&private_key.public_key()); + + let manifest = ManifestBuilder::new() + .lock_fee(account, 10.into()) + .mint_non_fungible( + RADIX_TOKEN, + [( + NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), + EmptyStruct {}, + )], + ) + .build(); + + let transaction = TransactionBuilder::new() + .header(header(0x0c, private_key.public_key())) + .manifest(manifest) + .notarize(&private_key) + .build(); + + // Act + test_inversion(&transaction); + let validation_result = statically_validate(&transaction); + + // Assert + assert_eq!( + validation_result, + StaticallyValidateTransactionResponse::Valid + ); +} + +fn header>(network_id: u8, notary_public_key: P) -> TransactionHeader { + TransactionHeader { + version: 0x01, + network_id, + start_epoch_inclusive: 10, + end_epoch_exclusive: 13, + nonce: 0x02, + notary_public_key: notary_public_key.into(), + notary_as_signatory: true, + cost_unit_limit: DEFAULT_COST_UNIT_LIMIT, + tip_percentage: 0, + } +} + +fn test_inversion(transaction: &NotarizedTransaction) { + let passed_manifest = transaction.signed_intent.intent.manifest.clone(); + let inverted_manifest = { + let network = radix_engine_toolkit::utils::network_definition_from_network_id( + transaction.signed_intent.intent.header.network_id, + ); + let decompiled = decompile(&passed_manifest.instructions, &network).unwrap(); + compile(&decompiled, &network, vec![]).unwrap() + }; + assert_eq!(passed_manifest, inverted_manifest); +} + +fn statically_validate( + transaction: &NotarizedTransaction, +) -> StaticallyValidateTransactionResponse { + let encoded_transaction = manifest_encode(&transaction).unwrap(); + let request = StaticallyValidateTransactionRequest { + compiled_notarized_intent: encoded_transaction, + validation_config: ValidationConfig::default( + transaction.signed_intent.intent.header.network_id, + ), + }; + StaticallyValidateTransactionHandler::fulfill(request).unwrap() +} + +#[derive(ScryptoSbor, NonFungibleData, ManifestSbor)] +struct EmptyStruct {} diff --git a/radix-engine-toolkit/tests/test_vector/instruction.rs b/radix-engine-toolkit/tests/test_vector/instruction.rs deleted file mode 100644 index 68b84ec2..00000000 --- a/radix-engine-toolkit/tests/test_vector/instruction.rs +++ /dev/null @@ -1,1673 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 - -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#![allow(dead_code)] -#![macro_use] -extern crate lazy_static; - -use native_transaction::{ - manifest::{ - ast, - generator::{generate_instruction, NameResolver}, - lexer::tokenize, - }, - validation::{ManifestIdValidator, ProofKind}, -}; -use radix_engine_toolkit::{model::*, EnumDiscriminator}; -use scrypto::prelude::{NonFungibleLocalId, *}; - -pub struct InstructionRepresentationTestVector { - pub instruction: Instruction, - pub json_representation: String, - pub manifest_representation: String, -} - -impl InstructionRepresentationTestVector { - pub fn new, T: AsRef>( - instruction: Instruction, - json_representation: S, - manifest_representation: T, - ) -> Self { - Self { - instruction, - json_representation: json_representation.as_ref().into(), - manifest_representation: manifest_representation.as_ref().into(), - } - } - - pub fn manifest_representation_as_ast_instruction(&self) -> ast::Instruction { - let ast_instruction = native_transaction::manifest::parser::Parser::new( - tokenize(&self.manifest_representation).expect("Failed to tokenize trusted value"), - ) - .parse_instruction() - .expect("Failed to parse trusted value to ast value"); - - // Compiling the AST instruction - this is done to ensure that the manifest representation - // in the test vector actually compiles since the AST is unstructured. - { - let bech32_coder = Bech32Coder::new(0xf2); - let mut id_validator = ManifestIdValidator::new(); - let mut name_resolver = NameResolver::new(); - let blobs = [( - "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" - .parse() - .unwrap(), - [10].into(), - )] - .into(); - - match ast_instruction { - ast::Instruction::ReturnToWorktop { ref bucket } - | ast::Instruction::BurnResource { ref bucket } - | ast::Instruction::CreateAccessController { - controlled_asset: ref bucket, - .. - } => { - if let ast::Value::Bucket(bucket_name) = bucket { - if let ast::Value::String(bucket_name) = &**bucket_name { - let bucket_id = id_validator.new_bucket().unwrap(); - name_resolver - .insert_bucket(bucket_name.to_owned(), bucket_id) - .unwrap(); - } - } - } - ast::Instruction::PushToAuthZone { ref proof } - | ast::Instruction::CloneProof { ref proof, .. } - | ast::Instruction::DropProof { ref proof, .. } => { - if let ast::Value::Proof(proof_name) = proof { - if let ast::Value::String(proof_name) = &**proof_name { - let proof_id = id_validator.new_proof(ProofKind::VirtualProof).unwrap(); - name_resolver - .insert_proof(proof_name.to_owned(), proof_id) - .unwrap(); - } - } - } - _ => {} - } - - generate_instruction( - &ast_instruction, - &mut id_validator, - &mut name_resolver, - bech32_coder.decoder(), - &blobs, - ) - .expect(format!("failed to compile instruction: {:?}", ast_instruction).as_str()); - } - - ast_instruction - } -} - -lazy_static::lazy_static! { - pub static ref INSTRUCTION_CONVERSION_TEST_VECTORS: Vec = vec![ - InstructionRepresentationTestVector::new( - Instruction::CallFunction { - package_address: Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: PackageAddress::Normal([0; 26]), - }, - }, - blueprint_name: Value::String { - value: "HelloWorld".into(), - }, - function_name: Value::String { - value: "world_hello".into(), - }, - arguments: Some(vec![Value::Decimal { - value: "129333".parse().unwrap(), - }]), - }, - r#" - { - "instruction": "CALL_FUNCTION", - "package_address": { - "type": "PackageAddress", - "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" - }, - "blueprint_name": { - "type": "String", - "value": "HelloWorld" - }, - "function_name": { - "type": "String", - "value": "world_hello" - }, - "arguments": [ - { - "type": "Decimal", - "value": "129333" - } - ] - } - "#, - r#"CALL_FUNCTION PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq") "HelloWorld" "world_hello" Decimal("129333");"#, - ), - InstructionRepresentationTestVector::new( - Instruction::CallMethod { - component_address: Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: scrypto::prelude::ComponentAddress::Normal([0; 26]), - }, - }, - method_name: Value::String { - value: "remove_user".into(), - }, - arguments: Some(vec![Value::Decimal { - value: "12".parse().unwrap(), - }]), - }, - r#" - { - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq8ecz5v" - }, - "method_name": { - "type": "String", - "value": "remove_user" - }, - "arguments": [ - { - "type": "Decimal", - "value": "12" - } - ] - } - "#, - r#" - CALL_METHOD - ComponentAddress("component_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq8ecz5v") - "remove_user" - Decimal("12"); - "#, - ), - InstructionRepresentationTestVector::new( - Instruction::TakeFromWorktop { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - into_bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "TAKE_FROM_WORKTOP", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r#" - TAKE_FROM_WORKTOP - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Bucket("ident"); - "#, - ), - InstructionRepresentationTestVector::new( - Instruction::TakeFromWorktopByAmount { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - amount: Value::Decimal { - value: "1".parse().unwrap(), - }, - into_bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "amount": { - "type": "Decimal", - "value": "1" - }, - "into_bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r#" - TAKE_FROM_WORKTOP_BY_AMOUNT - Decimal("1") - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Bucket("ident"); - "#, - ), - InstructionRepresentationTestVector::new( - Instruction::TakeFromWorktopByIds { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - ids: vec![Value::NonFungibleLocalId { - value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), - }], - into_bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "TAKE_FROM_WORKTOP_BY_IDS", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "ids": [ - { - "type": "NonFungibleLocalId", - "value": { - "type": "Integer", - "value": "1" - } - } - ], - "into_bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r##" - TAKE_FROM_WORKTOP_BY_IDS - Array(NonFungibleLocalId("#1#")) - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Bucket("ident"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::ReturnToWorktop { - bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "RETURN_TO_WORKTOP", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r##" - RETURN_TO_WORKTOP - Bucket("ident"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::AssertWorktopContains { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - }, - r#" - { - "instruction": "ASSERT_WORKTOP_CONTAINS", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - } - } - "#, - r#" - ASSERT_WORKTOP_CONTAINS - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"); - "#, - ), - InstructionRepresentationTestVector::new( - Instruction::AssertWorktopContainsByAmount { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - amount: Value::Decimal { - value: "1".parse().unwrap(), - }, - }, - r#" - { - "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "amount": { - "type": "Decimal", - "value": "1" - } - } - "#, - r#" - ASSERT_WORKTOP_CONTAINS_BY_AMOUNT - Decimal("1") - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"); - "#, - ), - InstructionRepresentationTestVector::new( - Instruction::AssertWorktopContainsByIds { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - ids: vec![Value::NonFungibleLocalId { - value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), - }], - }, - r#" - { - "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "ids": [ - { - "type": "NonFungibleLocalId", - "value": { - "type": "Integer", - "value": "1" - } - } - ] - } - "#, - r##" - ASSERT_WORKTOP_CONTAINS_BY_IDS - Array(NonFungibleLocalId("#1#")) - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::PopFromAuthZone { - into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r##" - POP_FROM_AUTH_ZONE - Proof("ident"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::PushToAuthZone { - proof: Value::Proof { - identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "PUSH_TO_AUTH_ZONE", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r##" - PUSH_TO_AUTH_ZONE - Proof("ident"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::ClearAuthZone, - r#" - { - "instruction": "CLEAR_AUTH_ZONE" - } - "#, - r##" - CLEAR_AUTH_ZONE; - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateProofFromAuthZone { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r#" - CREATE_PROOF_FROM_AUTH_ZONE - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Proof("ident"); - "#, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateProofFromAuthZoneByAmount { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - amount: Value::Decimal { - value: "1".parse().unwrap(), - }, - into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "amount": { - "type": "Decimal", - "value": "1" - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r#" - CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT - Decimal("1") - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Proof("ident"); - "#, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateProofFromAuthZoneByIds { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - ids: vec![Value::NonFungibleLocalId { - value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), - }], - into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "ids": [ - { - "type": "NonFungibleLocalId", - "value": { - "type": "Integer", - "value": "1" - } - } - ], - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r##" - CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS - Array(NonFungibleLocalId("#1#")) - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Proof("ident"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::CloneProof { - proof: Value::Proof { - identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), - }, - into_proof: Value::Proof { - identifier: ProofId(TransientIdentifier::String { value: "ident2".into() }), - }, - }, - r#" - { - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "ident" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "ident2" - } - } - } - "#, - r##" - CLONE_PROOF - Proof("ident") - Proof("ident2"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::DropProof { - proof: Value::Proof { - identifier: ProofId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r##" - DROP_PROOF - Proof("ident"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::DropAllProofs, - r#" - { - "instruction": "DROP_ALL_PROOFS" - } - "#, - r##" - DROP_ALL_PROOFS; - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::PublishPackage { - code: Value::Blob { - hash: Hash::from_str( - "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", - ) - .map(ManifestBlobRef) - .unwrap(), - }, - abi: Value::Blob { - hash: Hash::from_str( - "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", - ) - .map(ManifestBlobRef) - .unwrap(), - }, - royalty_config: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::Tuple, - entries: Vec::new(), - }, - metadata: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::String, - entries: Vec::new(), - }, - access_rules: Value::decode(scrypto_encode(&AccessRules::new()).unwrap(), 0xf2).unwrap(), - }, - r#" - { - "instruction": "PUBLISH_PACKAGE", - "code": { - "type": "Blob", - "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" - }, - "abi": { - "type": "Blob", - "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" - }, - "royalty_config": { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "Tuple", - "entries": [] - }, - "metadata": { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "String", - "entries": [] - }, - "access_rules": { - "type": "Tuple", - "elements": [ - { - "type": "Map", - "key_value_kind": "Enum", - "value_value_kind": "Enum", - "entries": [] - }, - { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "Enum", - "entries": [] - }, - { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "1" - } - }, - { - "type": "Map", - "key_value_kind": "Enum", - "value_value_kind": "Enum", - "entries": [] - }, - { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "Enum", - "entries": [] - }, - { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "1" - } - } - ] - } - } - "#, - r##" - PUBLISH_PACKAGE - Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") - Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") - Map() - Map() - Tuple( - Map(), - Map(), - Enum("AccessRule::DenyAll"), - Map(), - Map(), - Enum("AccessRule::DenyAll") - ); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::PublishPackageWithOwner { - code: Value::Blob { - hash: Hash::from_str( - "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", - ) - .map(ManifestBlobRef) - .unwrap(), - }, - abi: Value::Blob { - hash: Hash::from_str( - "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", - ) - .map(ManifestBlobRef) - .unwrap(), - }, - owner_badge: Value::NonFungibleGlobalId { - address: radix_engine_toolkit::NonFungibleGlobalId { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - non_fungible_local_id: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), - }, - }, - }, - r#" - { - "instruction": "PUBLISH_PACKAGE_WITH_OWNER", - "code": { - "type": "Blob", - "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" - }, - "abi": { - "type": "Blob", - "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b" - }, - "owner_badge": { - "type": "NonFungibleGlobalId", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "non_fungible_local_id": { - "type": "NonFungibleLocalId", - "value": { - "type": "Integer", - "value": "1" - } - } - } - } - "#, - r##" - PUBLISH_PACKAGE_WITH_OWNER - Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") - Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") - NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:#1#"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::BurnResource { - bucket: Value::Bucket { - identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), - }, - }, - r#" - { - "instruction": "BURN_RESOURCE", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "ident" - } - } - } - "#, - r##" - BURN_RESOURCE - Bucket("ident"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::RecallResource { - vault_id: Value::Bytes { - value: hex::decode( - "776e134adba9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492", - ) - .unwrap(), - }, - amount: Value::Decimal { - value: "1".parse().unwrap(), - }, - }, - r#" - { - "instruction": "RECALL_RESOURCE", - "vault_id": { - "type": "Bytes", - "value": "776e134adba9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" - }, - "amount": { - "type": "Decimal", - "value": "1" - } - } - "#, - r##" - RECALL_RESOURCE - Bytes("776e134adba9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492") - Decimal("1"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::SetMetadata { - entity_address: Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: FAUCET_COMPONENT, - }, - }, - key: Value::String { - value: "name".into(), - }, - value: Value::String { - value: "deadbeef".into(), - }, - }, - r#" - { - "instruction": "SET_METADATA", - "entity_address": { - "type": "ComponentAddress", - "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" - }, - "key": { - "type": "String", - "value": "name" - }, - "value": { - "type": "String", - "value": "deadbeef" - } - } - "#, - r##" - SET_METADATA - ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr") - "name" - "deadbeef"; - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::SetMetadata { - entity_address: Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: FAUCET_PACKAGE, - }, - }, - key: Value::String { - value: "name".into(), - }, - value: Value::String { - value: "deadbeef".into(), - }, - }, - r#" - { - "instruction": "SET_METADATA", - "entity_address": { - "type": "PackageAddress", - "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" - }, - "key": { - "type": "String", - "value": "name" - }, - "value": { - "type": "String", - "value": "deadbeef" - } - } - "#, - r##" - SET_METADATA - PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq") - "name" - "deadbeef"; - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::SetMetadata { - entity_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - key: Value::String { - value: "name".into(), - }, - value: Value::String { - value: "deadbeef".into(), - }, - }, - r#" - { - "instruction": "SET_METADATA", - "entity_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "key": { - "type": "String", - "value": "name" - }, - "value": { - "type": "String", - "value": "deadbeef" - } - } - "#, - r##" - SET_METADATA - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - "name" - "deadbeef"; - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::SetPackageRoyaltyConfig { - package_address: Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: FAUCET_PACKAGE, - }, - }, - royalty_config: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::Tuple, - entries: Vec::new(), - }, - }, - r#" - { - "instruction": "SET_PACKAGE_ROYALTY_CONFIG", - "package_address": { - "type": "PackageAddress", - "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" - }, - "royalty_config": { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "Tuple", - "entries": [] - } - } - "#, - r##" - SET_PACKAGE_ROYALTY_CONFIG - PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq") - Map(); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::SetComponentRoyaltyConfig { - component_address: Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: FAUCET_COMPONENT, - }, - }, - royalty_config: Value::Tuple { - elements: vec![ - Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::U32, - entries: vec![] - }, - Value::U32 { value: 1 } - ] - }, - }, - r#" - { - "instruction": "SET_COMPONENT_ROYALTY_CONFIG", - "component_address": { - "type": "ComponentAddress", - "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" - }, - "royalty_config": { - "type": "Tuple", - "elements": [ - { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "U32", - "entries": [] - }, - { - "type": "U32", - "value": "1" - } - ] - } - } - "#, - r##" - SET_COMPONENT_ROYALTY_CONFIG - ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr") - Tuple( - Map(), - 1u32 - ); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::ClaimPackageRoyalty { - package_address: Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: FAUCET_PACKAGE, - }, - }, - }, - r#" - { - "instruction": "CLAIM_PACKAGE_ROYALTY", - "package_address": { - "type": "PackageAddress", - "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq" - } - } - "#, - r##" - CLAIM_PACKAGE_ROYALTY - PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::ClaimComponentRoyalty { - component_address: Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: FAUCET_COMPONENT, - }, - }, - }, - r#" - { - "instruction": "CLAIM_COMPONENT_ROYALTY", - "component_address": { - "type": "ComponentAddress", - "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" - } - } - "#, - r##" - CLAIM_COMPONENT_ROYALTY - ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::SetMethodAccessRule { - entity_address: Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: FAUCET_COMPONENT, - }, - }, - index: Value::U32 { value: 0 }, - key: Value::Enum { - variant: EnumDiscriminator::U8 { - discriminator: 0 - }, - fields: Some(vec![ - Value::String { - value: "get_token".into() - } - ]) - }, - rule: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None, - }, - }, - r#" - { - "instruction": "SET_METHOD_ACCESS_RULE", - "entity_address": { - "type": "ComponentAddress", - "address": "component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr" - }, - "index": { - "type": "U32", - "value": "0" - }, - "key": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - }, - "fields": [ - { - "type": "String", - "value": "get_token" - } - ] - }, - "rule": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } - } - } - "#, - r##" - SET_METHOD_ACCESS_RULE - ComponentAddress("component_sim1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sxknsqr") - 0u32 - Enum(0u8, "get_token") - Enum(0u8); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::MintFungible { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - amount: Value::Decimal { - value: "1".parse().unwrap(), - }, - }, - r#" - { - "instruction": "MINT_FUNGIBLE", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "amount": { - "type": "Decimal", - "value": "1" - } - } - "#, - r##" - MINT_FUNGIBLE - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Decimal("1"); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::MintNonFungible { - resource_address: Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - }, - entries: Value::Map { - key_value_kind: ValueKind::NonFungibleLocalId, - value_value_kind: ValueKind::Tuple, - entries: Vec::new(), - }, - }, - r#" - { - "instruction": "MINT_NON_FUNGIBLE", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "entries": { - "type": "Map", - "key_value_kind": "NonFungibleLocalId", - "value_value_kind": "Tuple", - "entries": [] - } - } - "#, - r##" - MINT_NON_FUNGIBLE - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety") - Map(); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateFungibleResource { - divisibility: Value::U8 { value: 18 }, - metadata: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::String, - entries: Vec::new(), - }, - access_rules: Value::Map { - key_value_kind: ValueKind::Enum, - value_value_kind: ValueKind::Tuple, - entries: Vec::new(), - }, - initial_supply: Value::None, - }, - r#" - { - "instruction": "CREATE_FUNGIBLE_RESOURCE", - "divisibility": { - "type": "U8", - "value": "18" - }, - "metadata": { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "String", - "entries": [] - }, - "access_rules": { - "type": "Map", - "key_value_kind": "Enum", - "value_value_kind": "Tuple", - "entries": [] - }, - "initial_supply": { - "type": "None" - } - } - "#, - r##" - CREATE_FUNGIBLE_RESOURCE - 18u8 - Map() - Map() - None; - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateFungibleResourceWithOwner { - divisibility: Value::U8 { value: 18 }, - metadata: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::String, - entries: Vec::new(), - }, - owner_badge: Value::NonFungibleGlobalId { - address: radix_engine_toolkit::NonFungibleGlobalId { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - non_fungible_local_id: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), - }, - }, - initial_supply: Value::None, - }, - r#" - { - "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER", - "divisibility": { - "type": "U8", - "value": "18" - }, - "metadata": { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "String", - "entries": [] - }, - "owner_badge": { - "type": "NonFungibleGlobalId", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "non_fungible_local_id": { - "type": "NonFungibleLocalId", - "value": { - "type": "Integer", - "value": "1" - } - } - }, - "initial_supply": { - "type": "None" - } - } - "#, - r##" - CREATE_FUNGIBLE_RESOURCE_WITH_OWNER - 18u8 - Map() - NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:#1#") - None; - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateNonFungibleResource { - id_type: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None, - }, - metadata: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::String, - entries: Vec::new(), - }, - access_rules: Value::Map { - key_value_kind: ValueKind::Enum, - value_value_kind: ValueKind::Tuple, - entries: Vec::new(), - }, - initial_supply: Value::None, - }, - r#" - { - "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", - "id_type": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } - }, - "metadata": { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "String", - "entries": [] - }, - "access_rules": { - "type": "Map", - "key_value_kind": "Enum", - "value_value_kind": "Tuple", - "entries": [] - }, - "initial_supply": { - "type": "None" - } - } - "#, - r##" - CREATE_NON_FUNGIBLE_RESOURCE - Enum(0u8) - Map() - Map() - None; - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateNonFungibleResourceWithOwner { - id_type: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None, - }, - metadata: Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::String, - entries: Vec::new(), - }, - owner_badge: Value::NonFungibleGlobalId { - address: radix_engine_toolkit::NonFungibleGlobalId { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: RADIX_TOKEN, - }, - non_fungible_local_id: NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(1)), - }, - }, - initial_supply: Value::None, - }, - r#" - { - "instruction": "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER", - "id_type": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } - }, - "metadata": { - "type": "Map", - "key_value_kind": "String", - "value_value_kind": "String", - "entries": [] - }, - "owner_badge": { - "type": "NonFungibleGlobalId", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety" - }, - "non_fungible_local_id": { - "type": "NonFungibleLocalId", - "value": { - "type": "Integer", - "value": "1" - } - } - }, - "initial_supply": { - "type": "None" - } - } - "#, - r##" - CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER - Enum(0u8) - Map() - NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:#1#") - None; - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateAccessController { - controlled_asset: Value::Bucket { - identifier: BucketId(TransientIdentifier::String { value: "ident".into() }), - }, - primary_role: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None, - }, - recovery_role: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None, - }, - confirmation_role: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None, - }, - timed_recovery_delay_in_minutes: Value::Some { - value: Box::new(Value::U32 { value: 1 }), - }, - }, - r#" - { - "instruction": "CREATE_ACCESS_CONTROLLER", - "controlled_asset": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "ident" - } - }, - "primary_role": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } - }, - "recovery_role": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } - }, - "confirmation_role": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } - }, - "timed_recovery_delay_in_minutes": { - "type": "Some", - "value": { - "type": "U32", - "value": "1" - } - } - } - "#, - r##" - CREATE_ACCESS_CONTROLLER - Bucket("ident") - Enum(0u8) - Enum(0u8) - Enum(0u8) - Some(1u32); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateIdentity { - access_rule: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None, - }, - }, - r#" - { - "instruction": "CREATE_IDENTITY", - "access_rule": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } - } - } - "#, - r##" - CREATE_IDENTITY - Enum(0u8); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::AssertAccessRule { - access_rule: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None, - }, - }, - r#" - { - "instruction": "ASSERT_ACCESS_RULE", - "access_rule": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } - } - } - "#, - r##" - ASSERT_ACCESS_RULE - Enum(0u8); - "##, - ), - InstructionRepresentationTestVector::new( - Instruction::CreateValidator { - key: Value::EcdsaSecp256k1PublicKey { - public_key: - "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" - .parse() - .unwrap(), - }, - owner_access_rule: Value::Enum { - variant: EnumDiscriminator::U8 { discriminator: 0 }, - fields: None - } - }, - r#" - { - "instruction": "CREATE_VALIDATOR", - "key": { - "type": "EcdsaSecp256k1PublicKey", - "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" - }, - "owner_access_rule": { - "type": "Enum", - "variant": { - "type": "U8", - "discriminator": "0" - } - } - } - "#, - r##" - CREATE_VALIDATOR - EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798") - Enum(0u8); - "##, - ), - ]; -} diff --git a/radix-engine-toolkit/tests/test_vector/manifest/access_controller/create.rtm b/radix-engine-toolkit/tests/test_vector/manifest/access_controller/create.rtm deleted file mode 100644 index 44ef229d..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/access_controller/create.rtm +++ /dev/null @@ -1,6 +0,0 @@ -CREATE_ACCESS_CONTROLLER - Bucket(1u32) - Enum(0u8) - Enum(0u8) - Enum(0u8) - Some(1u32); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/access_controller/new.rtm b/radix-engine-toolkit/tests/test_vector/manifest/access_controller/new.rtm new file mode 100644 index 00000000..defe124d --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/access_controller/new.rtm @@ -0,0 +1,2 @@ +TAKE_FROM_WORKTOP Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Bucket("some_xrd"); +CREATE_ACCESS_CONTROLLER Bucket("some_xrd") Tuple(Enum(0u8), Enum(0u8), Enum(0u8)) Enum(0u8); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/access_rule/access_rule.rtm b/radix-engine-toolkit/tests/test_vector/manifest/access_rule/access_rule.rtm index e0a752f7..a724b87d 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/access_rule/access_rule.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/access_rule/access_rule.rtm @@ -1,5 +1,4 @@ SET_METHOD_ACCESS_RULE - ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") - 0u32 - Enum("AccessRuleKey::Scrypto", "test") + Address("resource_sim1qxntya3nlyju8zsj8h86fz8ma5yl8smwjlg9tckkqvrsxhzgyn") + Tuple(Enum("NodeModuleId::SELF"), "test") Enum("AccessRule::AllowAll"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/access_rule/assert_access_rule.rtm b/radix-engine-toolkit/tests/test_vector/manifest/access_rule/assert_access_rule.rtm index f5f4abf4..fb645170 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/access_rule/assert_access_rule.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/access_rule/assert_access_rule.rtm @@ -1,5 +1,5 @@ CALL_METHOD - ComponentAddress("account_sim1qwskd4q5jdywfw6f7jlwmcyp2xxq48uuwruc003x2kcskxh3na") + Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") "lock_fee" Decimal("10"); diff --git a/radix-engine-toolkit/tests/test_vector/manifest/account/multi_account_resource_transfer.rtm b/radix-engine-toolkit/tests/test_vector/manifest/account/multi_account_resource_transfer.rtm index 7b318503..fc83f578 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/account/multi_account_resource_transfer.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/account/multi_account_resource_transfer.rtm @@ -12,43 +12,43 @@ # that you are using is resim then you can safely ignore this warning. # ================================================================================================== CALL_METHOD - ComponentAddress("${this_account_component_address}") + Address("${this_account_component_address}") "lock_fee" Decimal("10"); # Withdrawing 330 XRD from the account component CALL_METHOD - ComponentAddress("${this_account_component_address}") - "withdraw_by_amount" - Decimal("330") - ResourceAddress("${xrd_resource_address}"); + Address("${this_account_component_address}") + "withdraw" + Address("${xrd_resource_address}") + Decimal("330"); # Taking 150 XRD from the worktop and depositing them into Account A TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("150") - ResourceAddress("${xrd_resource_address}") + Address("${xrd_resource_address}") Bucket("account_a_bucket"); CALL_METHOD - ComponentAddress("${account_a_component_address}") + Address("${account_a_component_address}") "deposit" Bucket("account_a_bucket"); # Taking 130 XRD from the worktop and depositing them into Account B TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("130") - ResourceAddress("${xrd_resource_address}") + Address("${xrd_resource_address}") Bucket("account_b_bucket"); CALL_METHOD - ComponentAddress("${account_b_component_address}") + Address("${account_b_component_address}") "deposit" Bucket("account_b_bucket"); # Taking 50 XRD from the worktop and depositing them into Account C TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("50") - ResourceAddress("${xrd_resource_address}") + Address("${xrd_resource_address}") Bucket("account_c_bucket"); CALL_METHOD - ComponentAddress("${account_c_component_address}") + Address("${account_c_component_address}") "deposit" Bucket("account_c_bucket"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/account/new.rtm b/radix-engine-toolkit/tests/test_vector/manifest/account/new.rtm new file mode 100644 index 00000000..dd30cd2f --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/account/new.rtm @@ -0,0 +1,2 @@ +CREATE_ACCOUNT + Enum(0u8); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm b/radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm index dc9b4ead..971710ea 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm @@ -8,19 +8,19 @@ # that you are using is resim then you can safely ignore this warning. # ================================================================================================== CALL_METHOD - ComponentAddress("${this_account_component_address}") + Address("${this_account_component_address}") "lock_fee" Decimal("10"); # Withdrawing 100 XRD from the account component CALL_METHOD - ComponentAddress("${this_account_component_address}") - "withdraw_by_amount" - Decimal("100") - ResourceAddress("${xrd_resource_address}"); + Address("${this_account_component_address}") + "withdraw" + Address("${xrd_resource_address}") + Decimal("100"); # Depositing all of the XRD withdrawn from the account into the other account CALL_METHOD - ComponentAddress("${other_account_component_address}") + Address("${other_account_component_address}") "deposit_batch" Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/call/call_function.rtm b/radix-engine-toolkit/tests/test_vector/manifest/call/call_function.rtm new file mode 100644 index 00000000..425d9507 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/call/call_function.rtm @@ -0,0 +1,5 @@ +CALL_FUNCTION + Address("package_sim1qr46xrzzzlgvqccwqptp9ujlqncamd6kexux05essnuqc933em") + "BlueprintName" + "f" + "string"; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/call/call_method.rtm b/radix-engine-toolkit/tests/test_vector/manifest/call/call_method.rtm new file mode 100644 index 00000000..01f62ed6 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/call/call_method.rtm @@ -0,0 +1,5 @@ +CALL_METHOD + Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") + "complicated_method" + Decimal("1") + PreciseDecimal("2"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/call/invocation.rtm b/radix-engine-toolkit/tests/test_vector/manifest/call/invocation.rtm deleted file mode 100644 index 67cdfd22..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/call/invocation.rtm +++ /dev/null @@ -1,11 +0,0 @@ -CALL_FUNCTION - PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe") - "BlueprintName" - "f" - "string"; - -CALL_METHOD - ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") - "complicated_method" - Decimal("1") - PreciseDecimal("2"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/call/values.rtm b/radix-engine-toolkit/tests/test_vector/manifest/call/values.rtm deleted file mode 100644 index 87c622e7..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/call/values.rtm +++ /dev/null @@ -1,87 +0,0 @@ -TAKE_FROM_WORKTOP - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") - Bucket("temp1"); -CREATE_PROOF_FROM_AUTH_ZONE - ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") - Proof("temp2"); - -CALL_METHOD - ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") - "with_some_basic_types" - - # Unit - Tuple() - ; - -CALL_METHOD - ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") - "with_aliases" - - # enum - None - Enum(0u8) - Some("hello") - Enum(1u8, "hello") - Ok("test") - Enum(0u8, "test") - Err("test123") - Enum(1u8, "test123") - Enum("Option::None") - Enum("Option::Some", "a") - Enum("Result::Ok", "b") - Enum("Result::Err", "c") - - # bytes - Bytes("deadbeef") - Array(5u8, 10u8, 255u8) - - # non-fungible address - NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:") - NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:#123#") - NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:#456#") - NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") - NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:#1234567890#") - Tuple(ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), NonFungibleLocalId("#1#")) - - # array - Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) - Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) - Array(NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:"), Tuple(ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), NonFungibleLocalId("#1#"))) - Array(NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag:"), Tuple(ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"), NonFungibleLocalId("#1#"))) - ; - -CALL_METHOD - ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") - "with_all_scrypto_custom_types" - - # RE global address types - PackageAddress("package_sim1qyqzcexvnyg60z7lnlwauh66nhzg3m8tch2j8wc0e70qkydk8r") - ComponentAddress("account_sim1q0u9gxewjxj8nhxuaschth2mgencma2hpkgwz30s9wlslthace") - ComponentAddress("epochmanager_sim1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvygtcq") - ComponentAddress("clock_sim1qcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqagpd30") - ComponentAddress("validator_sim1q5qszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqsvkh36j") - ComponentAddress("accesscontroller_sim1pspqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqq397jz") - ResourceAddress("resource_sim1qq8cays25704xdyap2vhgmshkkfyr023uxdtk59ddd4qs8cr5v") - - # RE interpreted types - # TODO: fix own syntax OR disallow own type in manifest - # Own("000000000000000000000000000000000000000000000000000000000000000005000000") - Blob("01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b") - - # TX interpreted types - Bucket("temp1") - Proof("temp2") - Expression("ENTIRE_WORKTOP") - - # Uninterpreted - Hash("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824") - EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798") - EcdsaSecp256k1Signature("0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e") - EddsaEd25519PublicKey("4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29") - EddsaEd25519Signature("ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09") - Decimal("1.2") - PreciseDecimal("1.2") - NonFungibleLocalId("") - NonFungibleLocalId("#12#") - NonFungibleLocalId("[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") - NonFungibleLocalId("{43968a72-5954-45da-9678-8659dd399faa}"); diff --git a/radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm b/radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm index adefd459..13591a78 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm @@ -10,18 +10,18 @@ # account component. However, since this example hows how to get free funds from the faucet, then # we can assume that our account component probably has no funds in the first place. CALL_METHOD - ComponentAddress("${faucet_component_address}") + Address("${faucet_component_address}") "lock_fee" Decimal("10"); # Calling the "free" method on the faucet component which is the method responsible for dispensing # XRD from the faucet. CALL_METHOD - ComponentAddress("${faucet_component_address}") + Address("${faucet_component_address}") "free"; # Depositing all of the XRD dispensed from the faucet into our account component. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "deposit_batch" Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/identity/new.rtm b/radix-engine-toolkit/tests/test_vector/manifest/identity/new.rtm new file mode 100644 index 00000000..4da4d183 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/identity/new.rtm @@ -0,0 +1,2 @@ +CREATE_IDENTITY + Enum(0u8); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/metadata/metadata.rtm b/radix-engine-toolkit/tests/test_vector/manifest/metadata/metadata.rtm index ad284600..fae0b2e3 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/metadata/metadata.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/metadata/metadata.rtm @@ -1,14 +1,26 @@ SET_METADATA - PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe") + Address("package_sim1qr46xrzzzlgvqccwqptp9ujlqncamd6kexux05essnuqc933em") "k" - "v"; + Enum(0u8, Enum(0u8, "v")); SET_METADATA - ComponentAddress("component_sim1qg2jwzl3hxnkqye8tfj5v3p2wp7cv9xdcjv4nl63refs785pvt") + Address("account_sim1qnkhnw506drsfhrjrzaw4aj2yrucezvj2w7jqqqm5zds7mngxh") "k" - "v"; + Enum(0u8, Enum(0u8, "v")); SET_METADATA - ResourceAddress("resource_sim1qq8cays25704xdyap2vhgmshkkfyr023uxdtk59ddd4qs8cr5v") + Address("resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe") "k" - "v"; \ No newline at end of file + Enum(0u8, Enum(0u8, "v")); + +REMOVE_METADATA + Address("package_sim1qr46xrzzzlgvqccwqptp9ujlqncamd6kexux05essnuqc933em") + "k"; + +REMOVE_METADATA + Address("account_sim1qnkhnw506drsfhrjrzaw4aj2yrucezvj2w7jqqqm5zds7mngxh") + "k"; + +REMOVE_METADATA + Address("resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe") + "k"; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/package/publish.rtm b/radix-engine-toolkit/tests/test_vector/manifest/package/publish.rtm index ef53ce7f..f77da610 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/package/publish.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/package/publish.rtm @@ -8,25 +8,22 @@ # Locking 10 XRD in fees from the account component. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "lock_fee" Decimal("10"); # Publishing a new package and setting some of its royalty and access rules. PUBLISH_PACKAGE Blob("${code_blob_hash}") - Blob("${abi_blob_hash}") + Blob("${schema_blob_hash}") Map() # Royalty Configuration Map() # Metadata Tuple( # Access Rules Struct - Map( # Method auth Field - Enum( - "AccessRuleKey::Native", - Enum( - "NativeFn::Package", - Enum("PackageFn::SetRoyaltyConfig") - ) - ), + Map( # Method auth Field + Tuple( + Enum("NodeModuleId::SELF"), + "set_royalty_config" + ), Enum( "AccessRuleEntry::AccessRule", Enum( @@ -43,12 +40,9 @@ PUBLISH_PACKAGE ) ) ), - Enum( - "AccessRuleKey::Native", - Enum( - "NativeFn::Package", - Enum("PackageFn::ClaimRoyalty") - ) + Tuple( + Enum("NodeModuleId::SELF"), + "claim_royalty" ), Enum( "AccessRuleEntry::AccessRule", @@ -66,12 +60,9 @@ PUBLISH_PACKAGE ) ) ), - Enum( - "AccessRuleKey::Native", - Enum( - "NativeFn::Metadata", - Enum("MetadataFn::Set") - ) + Tuple( + Enum("NodeModuleId::Metadata"), + "set" ), Enum( "AccessRuleEntry::AccessRule", @@ -89,12 +80,9 @@ PUBLISH_PACKAGE ) ) ), - Enum( - "AccessRuleKey::Native", - Enum( - "NativeFn::Metadata", - Enum("MetadataFn::Get") - ) + Tuple( + Enum("NodeModuleId::Metadata"), + "get" ), Enum( "AccessRuleEntry::AccessRule", @@ -103,14 +91,11 @@ PUBLISH_PACKAGE ), Map(), # Grouped Auth Field Enum("AccessRule::DenyAll"), # Default Auth Field - Map( # Method Auth Mutability Field - Enum( - "AccessRuleKey::Native", - Enum( - "NativeFn::Package", - Enum("PackageFn::SetRoyaltyConfig") - ) - ), + Map( # Method Auth Mutability Field + Tuple( + Enum("NodeModuleId::SELF"), + "set_royalty_config" + ), Enum( "AccessRule::Protected", Enum( @@ -124,13 +109,10 @@ PUBLISH_PACKAGE ) ) ), - Enum( - "AccessRuleKey::Native", - Enum( - "NativeFn::Package", - Enum("PackageFn::ClaimRoyalty") - ) - ), + Tuple( + Enum("NodeModuleId::SELF"), + "claim_royalty" + ), Enum( "AccessRule::Protected", Enum( @@ -144,12 +126,9 @@ PUBLISH_PACKAGE ) ) ), - Enum( - "AccessRuleKey::Native", - Enum( - "NativeFn::Metadata", - Enum("MetadataFn::Set") - ) + Tuple( + Enum("NodeModuleId::Metadata"), + "set" ), Enum( "AccessRule::Protected", @@ -164,13 +143,10 @@ PUBLISH_PACKAGE ) ) ), - Enum( - "AccessRuleKey::Native", - Enum( - "NativeFn::Metadata", - Enum("MetadataFn::Get") - ) - ), + Tuple( + Enum("NodeModuleId::Metadata"), + "get" + ), Enum( "AccessRule::Protected", Enum( diff --git a/radix-engine-toolkit/tests/test_vector/manifest/package/publish_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/package/publish_with_owner.rtm deleted file mode 100644 index 48f8d251..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/package/publish_with_owner.rtm +++ /dev/null @@ -1,19 +0,0 @@ -# This transaction manifest shows how a package can be published to the ledger - -# ================================================================================================== -# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST -# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all -# that you are using is resim then you can safely ignore this warning. -# ================================================================================================== - -# Locking 10 XRD in fees from the account component. -CALL_METHOD - ComponentAddress("${account_component_address}") - "lock_fee" - Decimal("10"); - -# Publishing a new package with an owner badge -PUBLISH_PACKAGE_WITH_OWNER - Blob("${code_blob_hash}") - Blob("${abi_blob_hash}") - NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/package/abi.blob b/radix-engine-toolkit/tests/test_vector/manifest/package/schema.blob similarity index 100% rename from radix-engine-toolkit/tests/test_vector/manifest/package/abi.blob rename to radix-engine-toolkit/tests/test_vector/manifest/package/schema.blob diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/auth_zone.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/auth_zone.rtm new file mode 100644 index 00000000..edb2bb3a --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/auth_zone.rtm @@ -0,0 +1,28 @@ +# Withdraw XRD from account +CALL_METHOD Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") "withdraw" Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Decimal("5.0"); + +# Create a proof from bucket, clone it and drop both +TAKE_FROM_WORKTOP Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Bucket("some_xrd"); +CREATE_PROOF_FROM_BUCKET Bucket("some_xrd") Proof("proof1"); +CLONE_PROOF Proof("proof1") Proof("proof2"); +DROP_PROOF Proof("proof1"); +DROP_PROOF Proof("proof2"); + +# Create a proof from account and drop it +CALL_METHOD Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") "create_proof_by_amount" Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Decimal("5.0"); +POP_FROM_AUTH_ZONE Proof("proof3"); +DROP_PROOF Proof("proof3"); + +# Compose proofs +CALL_METHOD Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") "create_proof_by_amount" Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Decimal("5.0"); +CREATE_PROOF_FROM_AUTH_ZONE Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Proof("Proof Name"); +CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT Decimal("1") Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Proof("proof4"); +CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS Array(NonFungibleLocalId("#123#")) Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Proof("proof5"); +CLEAR_AUTH_ZONE; + +# Drop all virtual proofs in the auth zone. +CLEAR_SIGNATURE_PROOFS; + +# Drop all proofs, and move resources to account +DROP_ALL_PROOFS; +CALL_METHOD Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") "deposit_batch" Expression("ENTIRE_WORKTOP"); diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply.rtm index e5c46e97..a61f4518 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply.rtm @@ -9,7 +9,7 @@ # Locking 10 XRD in fees from the account component. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "lock_fee" Decimal("10"); @@ -51,5 +51,4 @@ CREATE_FUNGIBLE_RESOURCE # │ │ │ Enum("ResourceMethodAuthKey::Withdraw"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")), Enum("ResourceMethodAuthKey::Deposit"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")) - ) - None; \ No newline at end of file + ); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply_with_owner.rtm deleted file mode 100644 index f6867a10..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply_with_owner.rtm +++ /dev/null @@ -1,26 +0,0 @@ -# This transaction manifest creates a new fungible resource with no initial supply and with an owner -# badge - -# ================================================================================================== -# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST -# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all -# that you are using is resim then you can safely ignore this warning. -# ================================================================================================== - -# Locking 10 XRD in fees from the account component. -CALL_METHOD - ComponentAddress("${account_component_address}") - "lock_fee" - Decimal("10"); - -# Creating a new resource with a divisibility of 18 and a name of `MyResource`. This resource has -# the default set of behaviors associated with owner badges. -CREATE_FUNGIBLE_RESOURCE_WITH_OWNER - 18u8 - Map( - "name", "MyResource", # Resource Name - "symbol", "RSRC", # Resource Symbol - "description", "A very innovative and important resource" # Resource Description - ) - NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}") - None; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply.rtm index cbb643d6..445382c1 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply.rtm @@ -9,13 +9,13 @@ # Locking 10 XRD in fees from the account component. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "lock_fee" Decimal("10"); # Creating a new resource with a divisibility of 18 and a name of `MyResource`. The resource has # default resource behavior where it can be withdrawn and deposited by anybody. -CREATE_FUNGIBLE_RESOURCE +CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY 18u8 Map( "name", "MyResource", # Resource Name @@ -52,11 +52,11 @@ CREATE_FUNGIBLE_RESOURCE Enum("ResourceMethodAuthKey::Withdraw"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")), Enum("ResourceMethodAuthKey::Deposit"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")) ) - Some(Decimal("${initial_supply}")); + Decimal("${initial_supply}"); # Depositing the entirety of the initial supply of the newly created resource into our account # component. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "deposit_batch" Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply_with_owner.rtm deleted file mode 100644 index f3d2bf37..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply_with_owner.rtm +++ /dev/null @@ -1,33 +0,0 @@ -# This transaction manifest creates a new fungible resource with initial supply and with an owner -# badge - -# ================================================================================================== -# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST -# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all -# that you are using is resim then you can safely ignore this warning. -# ================================================================================================== - -# Locking 10 XRD in fees from the account component. -CALL_METHOD - ComponentAddress("${account_component_address}") - "lock_fee" - Decimal("10"); - -# Creating a new resource with a divisibility of 18 and a name of `MyResource`. This resource has -# the default set of behaviors associated with owner badges. -CREATE_FUNGIBLE_RESOURCE_WITH_OWNER - 18u8 - Map( - "name", "MyResource", # Resource Name - "symbol", "RSRC", # Resource Symbol - "description", "A very innovative and important resource" # Resource Description - ) - NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}") - Some(Decimal("${initial_supply}")); - -# Depositing the entirety of the initial supply of the newly created resource into our account -# component. -CALL_METHOD - ComponentAddress("${account_component_address}") - "deposit_batch" - Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm index 5eec51bb..1aa9e8c9 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm @@ -9,45 +9,45 @@ # Locking 10 XRD in fees from the account component. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "lock_fee" Decimal("10"); # Creating a new resource CREATE_NON_FUNGIBLE_RESOURCE Enum("NonFungibleIdType::Integer") + Tuple(Tuple(Array(), Array(), Array()), Enum(0u8, 64u8), Array()) Map( "name", "MyResource", # Resource Name "description", "A very innovative and important resource" # Resource Description ) Map( - # This array of tuples defines the behavior of the resource. Each element in the array + # This array of tuples defines the behavior of the resource. Each element in the array # defines different resource behaviors. As an example, the first element in this array # defines the withdraw behavior while the second element in the array defines the deposit # behavior. - # - # Each tuple of the array is made up of two elements: + # + # Each tuple of the array is made up of two elements: # 1. An enum of the `ResourceMethodAuthKey` or the method that we would like to define the - # behavior of. - # 2. A tuple of two elements: - # a. The current behaviour. - # b. The mutability of the behaviour. As in, who can change the current behavior in + # behavior of. + # 2. A tuple of two elements: + # a. The current behaviour. + # b. The mutability of the behaviour. As in, who can change the current behavior in # the future. - # - # Lets take `Tuple(Enum("ResourceMethodAuthKey::Withdraw"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")))` as an + # + # Lets take `Tuple(Enum("ResourceMethodAuthKey::Withdraw"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")))` as an # example. This means that anybody who is in possession of the resource may withdraw it from # a vault that they control. This behavior is permanent and can not be changed by anybody # as the mutability is a `Enum("AccessRule::DenyAll")`. - # + # # ┌ We Are customizing the "Withdraw" behavior of the resource - # │ + # │ # │ ┌ The resource may be withdrawn by anybody who has it - # │ │ + # │ │ # │ │ ┌ The withdraw behavior (the resource is withdrawable by - # │ │ │ by anybody who has the resource) is permanent and can't + # │ │ │ by anybody who has the resource) is permanent and can't # │ │ │ be changed in the future. # │ │ │ Enum("ResourceMethodAuthKey::Withdraw"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")), Enum("ResourceMethodAuthKey::Deposit"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")) - ) - None; \ No newline at end of file + ); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply_with_owner.rtm deleted file mode 100644 index 51a290f1..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply_with_owner.rtm +++ /dev/null @@ -1,24 +0,0 @@ -# This transaction manifest creates a new non-fungible resource with no initial supply and with an -# owner badge - -# ================================================================================================== -# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST -# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all -# that you are using is resim then you can safely ignore this warning. -# ================================================================================================== - -# Locking 10 XRD in fees from the account component. -CALL_METHOD - ComponentAddress("${account_component_address}") - "lock_fee" - Decimal("10"); - -# Creating a new resource -CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER - Enum("NonFungibleIdType::Integer") - Map( - "name", "MyResource", # Resource Name - "description", "A very innovative and important resource" # Resource Description - ) - NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}") - None; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply.rtm index 0c4b2cec..b2f37d27 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply.rtm @@ -9,13 +9,14 @@ # Locking 10 XRD in fees from the account component. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "lock_fee" Decimal("10"); # Creating a new resource -CREATE_NON_FUNGIBLE_RESOURCE +CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY Enum("NonFungibleIdType::Integer") + Tuple(Tuple(Array(), Array(), Array()), Enum(0u8, 64u8), Array()) Map( "name", "MyResource", # Resource Name "description", "A very innovative and important resource" # Resource Description @@ -39,30 +40,25 @@ CREATE_NON_FUNGIBLE_RESOURCE # a vault that they control. This behavior is permanent and can not be changed by anybody # as the mutability is a `Enum("AccessRule::DenyAll")`. # - # ┌ We Are customizing the "Withdraw" behavior of the resource - # │ - # │ ┌ The resource may be withdrawn by anybody who has it - # │ │ - # │ │ ┌ The withdraw behavior (the resource is withdrawable by - # │ │ │ by anybody who has the resource) is permanent and can't - # │ │ │ be changed in the future. - # │ │ │ + # ┌ We Are customizing the "Withdraw" behavior of the resource + # │ + # │ ┌ The resource may be withdrawn by anybody who has it + # │ │ + # │ │ ┌ The withdraw behavior (the resource is withdrawable by + # │ │ │ by anybody who has the resource) is permanent and can't + # │ │ │ be changed in the future. + # │ │ │ Enum("ResourceMethodAuthKey::Withdraw"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")), Enum("ResourceMethodAuthKey::Deposit"), Tuple(Enum("AccessRule::AllowAll"), Enum("AccessRule::DenyAll")) ) - Some( - Map( - NonFungibleLocalId("${non_fungible_local_id}"), - Tuple( - Tuple("Hello World", Decimal("12")), # The immutable part of the data - Tuple(12u8, 19u128) # The mutable part of the data - ) - ) + Map( + NonFungibleLocalId("${non_fungible_local_id}"), + Tuple(Tuple("Hello World", Decimal("12"))) ); # Depositing the entirety of the initial supply of the newly created resource into our account # component. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "deposit_batch" Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply_with_owner.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply_with_owner.rtm deleted file mode 100644 index 25d278ac..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply_with_owner.rtm +++ /dev/null @@ -1,39 +0,0 @@ -# This transaction manifest creates a new non-fungible resource with initial supply and with an -# owner badge - -# ================================================================================================== -# WARNING: If you will be submitting this transaction through the Babylon wallet then you MUST -# remove the "lock_fee" instruction that you see below. Otherwise your transaction will fail. If all -# that you are using is resim then you can safely ignore this warning. -# ================================================================================================== - -# Locking 10 XRD in fees from the account component. -CALL_METHOD - ComponentAddress("${account_component_address}") - "lock_fee" - Decimal("10"); - -# Creating a new resource -CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER - Enum("NonFungibleIdType::Integer") - Map( - "name", "MyResource", # Resource Name - "description", "A very innovative and important resource" # Resource Description - ) - NonFungibleGlobalId("${owner_badge_resource_address}:${owner_badge_non_fungible_local_id}") - Some( - Map( - NonFungibleLocalId("${non_fungible_local_id}"), - Tuple( - Tuple("Hello World", Decimal("12")), # The immutable part of the data - Tuple(12u8, 19u128) # The mutable part of the data - ) - ) - ); - -# Depositing the entirety of the initial supply of the newly created resource into our account -# component. -CALL_METHOD - ComponentAddress("${account_component_address}") - "deposit_batch" - Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm index e294a76f..658c5c62 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm @@ -13,25 +13,25 @@ # a method for creating a proof and locking a fee at the same time. Therefore, locking a fee will be # its own method call and creating a proof will be its own method call. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "lock_fee" Decimal("10"); # We have a badge in our account component which allows us to mint this resource. So, we create a # proof from this badge which will allow us to mint the resource CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "create_proof_by_amount" - Decimal("1") - ResourceAddress("${minter_badge_resource_address}"); + Address("${minter_badge_resource_address}") + Decimal("1"); # Minting some amount of tokens from the mintable fungible resource MINT_FUNGIBLE - ResourceAddress("${mintable_resource_address}") + Address("${mintable_resource_address}") Decimal("${mint_amount}"); # Depositing the entirety of the newly minted tokens into out account CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "deposit_batch" Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm index 776cd418..dfcaf1ba 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm @@ -13,33 +13,32 @@ # a method for creating a proof and locking a fee at the same time. Therefore, locking a fee will be # its own method call and creating a proof will be its own method call. CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "lock_fee" Decimal("10"); # We have a badge in our account component which allows us to mint this resource. So, we create a # proof from this badge which will allow us to mint the resource CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "create_proof_by_amount" - Decimal("1") - ResourceAddress("${minter_badge_resource_address}"); + Address("${minter_badge_resource_address}") + Decimal("1"); # Minting a single non-fungible token from the resource. This non-fungible token has no data (this # is what the 5c2100 bit means, it's the SBOR representation of an empty struct) and has an id that # is user specified. MINT_NON_FUNGIBLE - ResourceAddress("${mintable_resource_address}") - Map( - NonFungibleLocalId("${non_fungible_local_id}"), - Tuple( - Tuple("Hello World", Decimal("12")), # The immutable part of the data - Tuple(12u8, 19u128) # The mutable part of the data + Address("${mintable_resource_address}") + Tuple( + Map( + NonFungibleLocalId("${non_fungible_local_id}"), + Tuple(Tuple()) ) ); # Depositing the entirety of the newly minted tokens into out account CALL_METHOD - ComponentAddress("${account_component_address}") + Address("${account_component_address}") "deposit_batch" Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/recall.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/recall.rtm index 3b9fc3d7..b92f579b 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/recall.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/recall.rtm @@ -1 +1 @@ -RECALL_RESOURCE Bytes("49cd9235ba62b2c217e32e5b4754c08219ef16389761356eaccbf6f6bdbfa44d00000000") Decimal("1.2"); +RECALL_RESOURCE Bytes("62b2c217e32e5b4754c08219ef16389761356eaccbf6f6bdbfa44d00000000") Decimal("1.2"); diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/worktop.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/worktop.rtm index 7405d693..dc401e1f 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/worktop.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/resources/worktop.rtm @@ -1,28 +1,18 @@ # Withdraw XRD from account -CALL_METHOD ComponentAddress("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064") "withdraw_by_amount" Decimal("5.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"); +CALL_METHOD Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") "withdraw" Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Decimal("5.0"); # Buy GUM with XRD -TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("2.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("xrd"); -CALL_METHOD ComponentAddress("component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum") "buy_gumball" Bucket("xrd"); -ASSERT_WORKTOP_CONTAINS_BY_AMOUNT Decimal("3.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"); -ASSERT_WORKTOP_CONTAINS ResourceAddress("resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6"); +TAKE_FROM_WORKTOP_BY_AMOUNT Decimal("2.0") Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Bucket("xrd"); +CALL_METHOD Address("component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn") "buy_gumball" Bucket("xrd"); +ASSERT_WORKTOP_CONTAINS_BY_AMOUNT Decimal("3.0") Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k"); +ASSERT_WORKTOP_CONTAINS Address("resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe"); # Create a proof from bucket, clone it and drop both -TAKE_FROM_WORKTOP ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("some_xrd"); -CREATE_PROOF_FROM_BUCKET Bucket("some_xrd") Proof("proof1"); -CLONE_PROOF Proof("proof1") Proof("proof2"); -DROP_PROOF Proof("proof1"); -DROP_PROOF Proof("proof2"); - -# Create a proof from account and drop it -CALL_METHOD ComponentAddress("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064") "create_proof_by_amount" Decimal("5.0") ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag"); -POP_FROM_AUTH_ZONE Proof("proof3"); -DROP_PROOF Proof("proof3"); +TAKE_FROM_WORKTOP Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Bucket("some_xrd"); # Return a bucket to worktop RETURN_TO_WORKTOP Bucket("some_xrd"); -TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleLocalId("#1#")) ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag") Bucket("nfts"); +TAKE_FROM_WORKTOP_BY_IDS Array(NonFungibleLocalId("#1#")) Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Bucket("nfts"); -# Drop all proofs, cancel all buckets and move resources to account -DROP_ALL_PROOFS; -CALL_METHOD ComponentAddress("account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064") "deposit_batch" Expression("ENTIRE_WORKTOP"); +# Move all resources in worktop to account +CALL_METHOD Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") "deposit_batch" Expression("ENTIRE_WORKTOP"); diff --git a/radix-engine-toolkit/tests/test_vector/manifest/royalty/royalty.rtm b/radix-engine-toolkit/tests/test_vector/manifest/royalty/royalty.rtm index 9f02219d..14ff511a 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/royalty/royalty.rtm +++ b/radix-engine-toolkit/tests/test_vector/manifest/royalty/royalty.rtm @@ -1,5 +1,5 @@ SET_PACKAGE_ROYALTY_CONFIG - PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe") + Address("package_sim1qr46xrzzzlgvqccwqptp9ujlqncamd6kexux05essnuqc933em") Map( "Blueprint", Tuple( @@ -11,7 +11,7 @@ SET_PACKAGE_ROYALTY_CONFIG ); SET_COMPONENT_ROYALTY_CONFIG - ComponentAddress("component_sim1qg2jwzl3hxnkqye8tfj5v3p2wp7cv9xdcjv4nl63refs785pvt") + Address("account_sim1qnkhnw506drsfhrjrzaw4aj2yrucezvj2w7jqqqm5zds7mngxh") Tuple( Map( "method", 1u32 @@ -20,7 +20,7 @@ SET_COMPONENT_ROYALTY_CONFIG ); CLAIM_PACKAGE_ROYALTY - PackageAddress("package_sim1qy4hrp8a9apxldp5cazvxgwdj80cxad4u8cpkaqqnhlsa3lfpe"); + Address("package_sim1qr46xrzzzlgvqccwqptp9ujlqncamd6kexux05essnuqc933em"); CLAIM_COMPONENT_ROYALTY - ComponentAddress("component_sim1qg2jwzl3hxnkqye8tfj5v3p2wp7cv9xdcjv4nl63refs785pvt"); \ No newline at end of file + Address("account_sim1qnkhnw506drsfhrjrzaw4aj2yrucezvj2w7jqqqm5zds7mngxh"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/values/values.rtm b/radix-engine-toolkit/tests/test_vector/manifest/values/values.rtm new file mode 100644 index 00000000..4689d358 --- /dev/null +++ b/radix-engine-toolkit/tests/test_vector/manifest/values/values.rtm @@ -0,0 +1,66 @@ +TAKE_FROM_WORKTOP + Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") + Bucket("temp1"); +CREATE_PROOF_FROM_AUTH_ZONE + Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") + Proof("temp2"); + +CALL_METHOD + Address("component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn") + "aliases" + + # enum + None + Enum(0u8) + Some("hello") + Enum(1u8, "hello") + Ok("test") + Enum(0u8, "test") + Err("test123") + Enum(1u8, "test123") + Enum("Option::None") + Enum("Option::Some", "a") + Enum("Result::Ok", "b") + Enum("Result::Err", "c") + + # bytes + Bytes("deadbeef") + Array(5u8, 10u8, 255u8) + + # non-fungible address + NonFungibleGlobalId("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k:") + NonFungibleGlobalId("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k:#123#") + NonFungibleGlobalId("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k:#456#") + NonFungibleGlobalId("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k:[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") + NonFungibleGlobalId("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k:#1234567890#") + Tuple(Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k"), NonFungibleLocalId("#1#")) + + # array + Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) + Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) + Array(NonFungibleGlobalId("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k:"), Tuple(Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k"), NonFungibleLocalId("#1#"))) + Array(NonFungibleGlobalId("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k:"), Tuple(Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k"), NonFungibleLocalId("#1#"))); + +CALL_METHOD + Address("component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn") + "custom_types" + + # Address + Address("package_sim1qr46xrzzzlgvqccwqptp9ujlqncamd6kexux05essnuqc933em") + Address("account_sim1qnkhnw506drsfhrjrzaw4aj2yrucezvj2w7jqqqm5zds7mngxh") + Address("epochmanager_sim1q5qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq7e94kj") + Address("clock_sim1quqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq04vnla") + Address("validator_sim1qcqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqsncq6gd") + Address("accesscontroller_sim1p5qszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs8w8kkt") + + Bucket("temp1") + Proof("temp2") + Expression("ENTIRE_WORKTOP") + Blob("5b4b01a4a3892ea3751793da57f072ae08eec694ddcda872239fc8239e4bcd1b") + + Decimal("1.2") + PreciseDecimal("1.2") + NonFungibleLocalId("") + NonFungibleLocalId("#12#") + NonFungibleLocalId("[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") + NonFungibleLocalId("{43968a72-5954-45da-9678-8659dd399faa}"); diff --git a/radix-engine-toolkit/tests/test_vector/mod.rs b/radix-engine-toolkit/tests/test_vector/mod.rs deleted file mode 100644 index 71be00be..00000000 --- a/radix-engine-toolkit/tests/test_vector/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod instruction; -pub mod value; - -pub use instruction::*; -pub use value::*; diff --git a/radix-engine-toolkit/tests/test_vector/value.rs b/radix-engine-toolkit/tests/test_vector/value.rs deleted file mode 100644 index 384d00f4..00000000 --- a/radix-engine-toolkit/tests/test_vector/value.rs +++ /dev/null @@ -1,449 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#![allow(dead_code)] -#![macro_use] - -use std::collections::BTreeMap; - -use native_transaction::manifest::generator::{generate_value, NameResolver}; -use native_transaction::manifest::lexer::tokenize; -use radix_engine_toolkit::{address::*, BucketId, ProofId, TransientIdentifier}; -use radix_engine_toolkit::{Value, ValueKind}; -use scrypto::prelude::{ - BytesNonFungibleLocalId, Hash, IntegerNonFungibleLocalId, ScryptoValue, - StringNonFungibleLocalId, UUIDNonFungibleLocalId, -}; -use scrypto::runtime::ManifestBlobRef; -extern crate lazy_static; - -pub struct ValueRepresentationTestVector { - pub value: Value, - pub json_representation: String, - pub manifest_representation: String, -} - -impl ValueRepresentationTestVector { - pub fn new, T: AsRef>( - value: Value, - json_representation: S, - manifest_representation: T, - ) -> Self { - Self { - value, - json_representation: json_representation.as_ref().into(), - manifest_representation: manifest_representation.as_ref().into(), - } - } - - pub fn manifest_representation_as_ast_value(&self) -> native_transaction::manifest::ast::Value { - native_transaction::manifest::parser::Parser::new( - tokenize(&self.manifest_representation).expect("Failed to tokenize trusted value"), - ) - .parse_value() - .expect("Failed to parse trusted value to ast value") - } - - pub fn manifest_representation_as_scrypto_value( - &self, - bech32_coder: &Bech32Coder, - ) -> ScryptoValue { - let mut blobs = BTreeMap::>::new(); - if let Value::Blob { ref hash } = self.value { - blobs.insert(hash.0, Vec::new()); - }; - - let ast_value = self.manifest_representation_as_ast_value(); - generate_value( - &ast_value, - None, - &mut NameResolver::new(), - bech32_coder.decoder(), - &blobs, - ) - .expect("Failed to generate scrypto value from ast_value") - } -} - -lazy_static::lazy_static! { - pub static ref VALUE_CONVERSION_TEST_VECTORS: Vec = vec![ - // ================ - // Primitive Types - // ================ - - // Unit and Boolean - ValueRepresentationTestVector::new( - Value::Bool { value: true }, - r#"{"type": "Bool", "value": true}"#, - r#"true"#, - ), - ValueRepresentationTestVector::new( - Value::Bool { value: false }, - r#"{"type": "Bool", "value": false}"#, - r#"false"#, - ), - // Unsigned Integers - ValueRepresentationTestVector::new( - Value::U8 { value: 19 }, - r#"{"type": "U8", "value": "19"}"#, - "19u8" - ), - ValueRepresentationTestVector::new( - Value::U16 { value: 19 }, - r#"{"type": "U16", "value": "19"}"#, - "19u16" - ), - ValueRepresentationTestVector::new( - Value::U32 { value: 19 }, - r#"{"type": "U32", "value": "19"}"#, - "19u32" - ), - ValueRepresentationTestVector::new( - Value::U64 { value: 19 }, - r#"{"type": "U64", "value": "19"}"#, - "19u64" - ), - ValueRepresentationTestVector::new( - Value::U128 { value: 19 }, - r#"{"type": "U128", "value": "19"}"#, - "19u128" - ), - // Signed Integers - ValueRepresentationTestVector::new( - Value::I8 { value: 19 }, - r#"{"type": "I8", "value": "19"}"#, - "19i8" - ), - ValueRepresentationTestVector::new( - Value::I16 { value: 19 }, - r#"{"type": "I16", "value": "19"}"#, - "19i16" - ), - ValueRepresentationTestVector::new( - Value::I32 { value: 19 }, - r#"{"type": "I32", "value": "19"}"#, - "19i32" - ), - ValueRepresentationTestVector::new( - Value::I64 { value: 19 }, - r#"{"type": "I64", "value": "19"}"#, - "19i64" - ), - ValueRepresentationTestVector::new( - Value::I128 { value: 19 }, - r#"{"type": "I128", "value": "19"}"#, - "19i128" - ), - // String - ValueRepresentationTestVector::new( - Value::String { - value: "P2P Cash System".into(), - }, - r#"{"type": "String", "value": "P2P Cash System"}"#, - r#""P2P Cash System""#, - ), - // Enums and Enum Aliases (Option & Result) - ValueRepresentationTestVector::new( - Value::Enum { - variant: radix_engine_toolkit::EnumDiscriminator::U8{discriminator: 1}, - fields: Some(vec![Value::String { - value: "Component".into(), - }]), - }, - r#"{"type": "Enum", "variant": {"type": "U8", "discriminator": "1"}, "fields": [{"type": "String", "value": "Component"}]}"#, - r#"Enum("Option::Some", "Component")"#, - ), - ValueRepresentationTestVector::new( - Value::Some { - value: Box::new(Value::String { - value: "Component".into(), - }), - }, - r#"{"type": "Some", "value": {"type": "String", "value": "Component"}}"#, - r#"Some("Component")"#, - ), - ValueRepresentationTestVector::new( - Value::None, - r#"{"type": "None"}"#, - r#"None"#, - ), - ValueRepresentationTestVector::new( - Value::Ok { - value: Box::new(Value::String { - value: "Component".into(), - }), - }, - r#"{"type": "Ok", "value": {"type": "String", "value": "Component"}}"#, - r#"Ok("Component")"#, - ), - ValueRepresentationTestVector::new( - Value::Err { - value: Box::new(Value::String { - value: "Component".into(), - }), - }, - r#"{"type": "Err", "value": {"type": "String", "value": "Component"}}"#, - r#"Err("Component")"#, - ), - // ================= - // Collection Types - // ================= - ValueRepresentationTestVector::new( - Value::Array { - element_kind: ValueKind::String, - elements: vec![Value::String { - value: "World, Hello!".into(), - }], - }, - r#"{"type": "Array", "element_kind": "String", "elements": [{"type": "String", "value": "World, Hello!"}]}"#, - r#"Array("World, Hello!")"#, - ), - ValueRepresentationTestVector::new( - Value::Map { - key_value_kind: ValueKind::String, - value_value_kind: ValueKind::U16, - entries: vec![ - ( - Value::String { - value: "Hello, World!".into() - }, - Value::U16 { value: 919 } - ), - ( - Value::String { - value: "World, Hello!".into() - }, - Value::U16 { value: 111 } - ) - ] - }, - r#"{"type": "Map", "key_value_kind": "String", "value_value_kind": "U16", "entries": [[{"type":"String","value":"Hello, World!"},{"type":"U16","value":"919"}],[{"type":"String","value":"World, Hello!"},{"type":"U16","value":"111"}]]}"#, - r#"Map("Hello, World!", 919u16, "World, Hello!", 111u16)"#, - ), - ValueRepresentationTestVector::new( - Value::Tuple { - elements: vec![Value::I64 { value: 19 }, Value::I8 { value: 19 }], - }, - r#"{"type": "Tuple", "elements": [{"type": "I64", "value": "19"}, {"type": "I8", "value": "19"}]}"#, - "Tuple(19i64, 19i8)" - ), - // ============================ - // Decimal And Precise Decimal - // ============================ - ValueRepresentationTestVector::new( - Value::Decimal { - value: "1923319912.102221313".parse().unwrap(), - }, - r#"{"type": "Decimal", "value": "1923319912.102221313"}"#, - r#"Decimal("1923319912.102221313")"#, - ), - ValueRepresentationTestVector::new( - Value::PreciseDecimal { - value: "1923319912.102221313".parse().unwrap(), - }, - r#"{"type": "PreciseDecimal", "value": "1923319912.102221313"}"#, - r#"PreciseDecimal("1923319912.102221313")"#, - ), - // ============== - // Address Types - // ============== - ValueRepresentationTestVector::new( - Value::ComponentAddress { - address: NetworkAwareComponentAddress { - network_id: 0xf2, - address: scrypto::prelude::ComponentAddress::Account([0; 26]), - }, - }, - r#"{"type": "ComponentAddress", "address": "account_sim1qvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg5cu7q"}"#, - r#"ComponentAddress("account_sim1qvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg5cu7q")"#, - ), - ValueRepresentationTestVector::new( - Value::ResourceAddress { - address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - }, - r#"{"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}"#, - r#"ResourceAddress("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety")"#, - ), - ValueRepresentationTestVector::new( - Value::PackageAddress { - address: NetworkAwarePackageAddress { - network_id: 0xf2, - address: scrypto::prelude::PackageAddress::Normal([0; 26]), - }, - }, - r#"{"type": "PackageAddress", "address": "package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq"}"#, - r#"PackageAddress("package_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxrmwtq")"#, - ), - // ============== - // Cryptographic - // ============== - ValueRepresentationTestVector::new( - Value::Hash { value: "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap() }, - r#"{"type": "Hash", "value": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"}"#, - r#"Hash("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")"#, - ), - ValueRepresentationTestVector::new( - Value::EcdsaSecp256k1PublicKey { public_key: "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798".parse().unwrap() }, - r#"{"type": "EcdsaSecp256k1PublicKey", "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"}"#, - r#"EcdsaSecp256k1PublicKey("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")"#, - ), - ValueRepresentationTestVector::new( - Value::EddsaEd25519PublicKey { public_key: "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29".parse().unwrap() }, - r#"{"type": "EddsaEd25519PublicKey", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29"}"#, - r#"EddsaEd25519PublicKey("4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29")"#, - ), - ValueRepresentationTestVector::new( - Value::EcdsaSecp256k1Signature { signature: "0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e".parse().unwrap() }, - r#"{"type": "EcdsaSecp256k1Signature", "signature": "0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e"}"#, - r#"EcdsaSecp256k1Signature("0079224ea514206706298d8d620f660828f7987068d6d02757e6f3cbbf4a51ab133395db69db1bc9b2726dd99e34efc252d8258dcb003ebaba42be349f50f7765e")"#, - ), - ValueRepresentationTestVector::new( - Value::EddsaEd25519Signature { signature: "ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09".parse().unwrap() }, - r#"{"type": "EddsaEd25519Signature", "signature": "ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09"}"#, - r#"EddsaEd25519Signature("ce993adc51111309a041faa65cbcf1154d21ed0ecdc2d54070bc90b9deb744aa8605b3f686fa178fba21070b4a4678e54eee3486a881e0e328251cd37966de09")"#, - ), - - // =================== - // Buckets and Proofs - // =================== - ValueRepresentationTestVector::new( - Value::Bucket { identifier: BucketId(TransientIdentifier::String{ value: "xrd_bucket".into()}) }, - r#"{"type": "Bucket", "identifier": {"type": "String", "value": "xrd_bucket"}}"#, - r#"Bucket("xrd_bucket")"# - ), - ValueRepresentationTestVector::new( - Value::Bucket { identifier: BucketId(TransientIdentifier::U32{ value: 28}) }, - r#"{"type": "Bucket", "identifier": {"type": "U32", "value": "28"}}"#, - r#"Bucket(28u32)"# - ), - ValueRepresentationTestVector::new( - Value::Proof { identifier: ProofId(TransientIdentifier::String{ value: "xrd_proof".into()}) }, - r#"{"type": "Proof", "identifier": {"type": "String", "value": "xrd_proof"}}"#, - r#"Proof("xrd_proof")"# - ), - ValueRepresentationTestVector::new( - Value::Proof { identifier: ProofId(TransientIdentifier::U32{ value: 28}) }, - r#"{"type": "Proof", "identifier": {"type": "U32", "value": "28"}}"#, - r#"Proof(28u32)"# - ), - - // ========================== - // Non Fungible Id & Address - // ========================== - - ValueRepresentationTestVector::new( - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(114441894733333)) }, - r#"{"type": "NonFungibleLocalId", "value": {"type": "Integer", "value": "114441894733333"}}"#, - "NonFungibleLocalId(\"#114441894733333#\")" - ), - ValueRepresentationTestVector::new( - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::UUID(UUIDNonFungibleLocalId::new(238510006928098330588051703199685491739).unwrap()) }, - r#"{"type": "NonFungibleLocalId", "value": {"type": "UUID", "value": "238510006928098330588051703199685491739"}}"#, - r#"NonFungibleLocalId("{b36f5b3f-835b-406c-980f-7788d8f13c1b}")"#, - ), - ValueRepresentationTestVector::new( - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::String(StringNonFungibleLocalId::new("hello_world".into()).unwrap()) }, - r#"{"type": "NonFungibleLocalId", "value": {"type": "String", "value": "hello_world"}}"#, - r#"NonFungibleLocalId("")"#, - ), - ValueRepresentationTestVector::new( - Value::NonFungibleLocalId { value: scrypto::prelude::NonFungibleLocalId::Bytes(BytesNonFungibleLocalId::new(vec![0x10, 0xa2, 0x31, 0x01]).unwrap()) }, - r#"{"type": "NonFungibleLocalId", "value": {"type": "Bytes", "value": "10a23101"}}"#, - r#"NonFungibleLocalId("[10a23101]")"#, - ), - - ValueRepresentationTestVector::new( - Value::NonFungibleGlobalId { - address: radix_engine_toolkit::model::NonFungibleGlobalId { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Integer(IntegerNonFungibleLocalId::new(114441894733333)) - } - }, - r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "Integer", "value": "114441894733333"}}}"#, - r#"NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:#114441894733333#")"#, - ), - ValueRepresentationTestVector::new( - Value::NonFungibleGlobalId { - address: radix_engine_toolkit::model::NonFungibleGlobalId { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::UUID(UUIDNonFungibleLocalId::new(238510006928098330588051703199685491739).unwrap()) - } - }, - r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "UUID", "value": "238510006928098330588051703199685491739"}}}"#, - r#"NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:{b36f5b3f-835b-406c-980f-7788d8f13c1b}")"#, - ), - ValueRepresentationTestVector::new( - Value::NonFungibleGlobalId { - address: radix_engine_toolkit::model::NonFungibleGlobalId { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::String(StringNonFungibleLocalId::new("hello_world".into()).unwrap()) - } - }, - r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "String", "value": "hello_world"}}}"#, - r#"NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:")"#, - ), - ValueRepresentationTestVector::new( - Value::NonFungibleGlobalId { - address: radix_engine_toolkit::model::NonFungibleGlobalId { - resource_address: NetworkAwareResourceAddress { - network_id: 0xf2, - address: scrypto::prelude::ResourceAddress::Normal([0; 26]), - }, - non_fungible_local_id: scrypto::prelude::NonFungibleLocalId::Bytes(BytesNonFungibleLocalId::new(vec![0x10, 0xa2, 0x31, 0x01]).unwrap()) - } - }, - r#"{"type": "NonFungibleGlobalId", "resource_address": {"type": "ResourceAddress", "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety"}, "non_fungible_local_id": {"type": "NonFungibleLocalId", "value": {"type": "Bytes", "value": "10a23101"}}}"#, - r#"NonFungibleGlobalId("resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz8qety:[10a23101]"))"#, - ), - - // ================= - // Other Misc Types - // ================= - ValueRepresentationTestVector::new( - Value::Blob { hash: ManifestBlobRef("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824".parse().unwrap()) }, - r#"{"type": "Blob", "hash": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"}"#, - r#"Blob("2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824")"# - ), - ValueRepresentationTestVector::new( - Value::Expression { value: scrypto::runtime::ManifestExpression::EntireAuthZone }, - r#"{"type": "Expression", "value": "ENTIRE_AUTH_ZONE"}"#, - r#"Expression("ENTIRE_AUTH_ZONE")"# - ), - ValueRepresentationTestVector::new( - Value::Expression { value: scrypto::runtime::ManifestExpression::EntireWorktop }, - r#"{"type": "Expression", "value": "ENTIRE_WORKTOP"}"#, - r#"Expression("ENTIRE_WORKTOP")"# - ), - ValueRepresentationTestVector::new( - Value::Bytes { value: vec![0x12, 0x19, 0x12, 0x20, 0x8] }, - r#"{"type": "Bytes", "value": "1219122008"}"#, - r#"Bytes("1219122008")"# - ), - ]; -} diff --git a/radix-engine-toolkit/tests/value.rs b/radix-engine-toolkit/tests/value.rs deleted file mode 100644 index ae16a6d6..00000000 --- a/radix-engine-toolkit/tests/value.rs +++ /dev/null @@ -1,264 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -mod test_vector; - -use radix_engine_toolkit::{ - model::{Bech32Coder, TransientIdentifier, Value}, - traverse_value, BucketId, ProofId, ValueAliasingVisitor, -}; -use scrypto::prelude::*; -pub use test_vector::*; - -#[test] -fn serialized_values_match_expected() { - // Checking that the serialization of values matches - for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - // Act - let expected_serialized_value: serde_json::Value = - serde_json::from_str(&test_vector.json_representation) - .expect("Failed to deserialize trusted value"); - let serialized_value = - serde_json::to_value(&test_vector.value).expect("Failed to serialize trusted value"); - - // Assert - assert_eq!(expected_serialized_value, serialized_value,); - } -} - -#[test] -fn deserialized_values_match_expected() { - // Checking that the deserialization of values matches - for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - // Act - let expected_value = &test_vector.value; - let deserialized_value = serde_json::from_str(&test_vector.json_representation) - .expect("Deserialization failed!"); - - // Assert - assert_eq!(*expected_value, deserialized_value) - } -} - -/// # Background -/// -/// There are methods on the [Value] model to convert a [Value] to a -/// [radix_transaction::manifest::ast::Value]. This conversion requires some domain-specific -/// knowledge as to what the abstract syntax tree looks like. -/// -/// As an example for a `ResourceAddress("some_address")` in the manifest we know that this is an -/// `AstValue::ResourceAddress` with a `AstValue::String` inside of it. Because of the -/// domain-knowledge requirement for this conversion, the transaction compiler could have a change -/// made to it which changes the expected structure of the AST. There would likely be no -/// compile-time errors as the AST uses an unstructured value model. -/// -/// # Purpose -/// -/// The purpose of this test is to check that the conversion of a [Value] to a -/// [radix_transaction::manifest::ast::Value] matches the abstract syntax tree that is generated by -/// the transaction compiler for an equivalent manifest string value. -#[test] -fn value_ast_conversions_match_that_produced_by_transaction_compiler() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - let expected_ast_value = test_vector.manifest_representation_as_ast_value(); - - // Act - let ast_value = test_vector - .value - .to_ast_value(&bech32_coder) - .expect("Value -> AstValue conversion of trusted value failed"); - - // Assert - assert_eq!(expected_ast_value, ast_value) - } -} - -#[test] -fn value_scrypto_value_conversion_match_that_produced_by_transaction_compiler() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - // This test will fail (as expected) for buckets and proofs with string - // TransientIdentifiers. So, we skip those tests - if let Value::Bucket { ref identifier } = test_vector.value { - if let TransientIdentifier::String { .. } = identifier.0 { - continue; - } - } else if let Value::Proof { ref identifier } = test_vector.value { - if let TransientIdentifier::String { .. } = identifier.0 { - continue; - } - } - - let expected_scrypto_value = - test_vector.manifest_representation_as_scrypto_value(&bech32_coder); - - // Act - let scrypto_value = test_vector - .value - .to_scrypto_value() - .expect("Failed to convert a trusted value to a scrypto value"); - - // Assert - assert_eq!(scrypto_value, expected_scrypto_value); - } -} - -#[test] -fn no_information_is_lost_when_converting_value_to_ast_value_and_back() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - let expected_value = &test_vector.value; - - // Act - let ast_value = Value::from_ast_value( - &test_vector - .value - .to_ast_value(&bech32_coder) - .expect("Value -> AstValue conversion of trusted value failed"), - &bech32_coder, - ) - .expect("AstValue -> Value for a trusted value failed"); - - // Assert - assert_eq!(*expected_value, ast_value) - } -} - -#[test] -fn no_information_is_lost_when_converting_value_to_scrypto_value_and_back() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - match test_vector.value { - Value::Bucket { - identifier: BucketId(TransientIdentifier::String { .. }), - } - | Value::Proof { - identifier: ProofId(TransientIdentifier::String { .. }), - } - | Value::Some { .. } - | Value::None - | Value::Ok { .. } - | Value::Err { .. } => continue, - _ => {} - } - - let expected_value = &test_vector.value; - - // Act - let mut ast_value = Value::from_scrypto_value( - &test_vector - .value - .to_scrypto_value() - .expect("Value -> AstValue conversion of trusted value failed"), - bech32_coder.network_id(), - ); - alias(&mut ast_value).unwrap(); - - // Assert - assert_eq!(*expected_value, ast_value) - } -} - -#[test] -fn sbor_encoding_value_yields_expected_result() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - // This test will fail (as expected) for buckets and proofs with string - // TransientIdentifiers. So, we skip those tests - match test_vector.value { - Value::Bucket { - identifier: BucketId(TransientIdentifier::String { .. }), - } - | Value::Proof { - identifier: ProofId(TransientIdentifier::String { .. }), - } - | Value::Some { .. } - | Value::None - | Value::Ok { .. } - | Value::Err { .. } => continue, - _ => {} - } - - let expected_encoding = - scrypto_encode(&test_vector.manifest_representation_as_scrypto_value(&bech32_coder)) - .unwrap(); - - // Act - let encoded_value = test_vector.value.encode().unwrap(); - - // Assert - assert_eq!(*expected_encoding, encoded_value) - } -} - -#[test] -fn sbor_decoding_value_yields_expected_result() { - // Arrange - let bech32_coder = Bech32Coder::new(0xf2); - - // Testing that the Value -> AstValue conversion matches that obtained from parsing the manifest - for test_vector in VALUE_CONVERSION_TEST_VECTORS.iter() { - // This test will fail (as expected) for buckets and proofs with string - // TransientIdentifiers. So, we skip those tests - match test_vector.value { - Value::Bucket { - identifier: BucketId(TransientIdentifier::String { .. }), - } - | Value::Proof { - identifier: ProofId(TransientIdentifier::String { .. }), - } - | Value::Some { .. } - | Value::None - | Value::Ok { .. } - | Value::Err { .. } => continue, - _ => {} - } - - let expected_value = &test_vector.value; - let encoded_value = - scrypto_encode(&test_vector.manifest_representation_as_scrypto_value(&bech32_coder)) - .unwrap(); - - // Act - let mut value = - Value::decode(encoded_value, 0xf2).expect("Failed to SBOR decode trusted value"); - alias(&mut value).unwrap(); - - // Assert - assert_eq!(*expected_value, value) - } -} - -fn alias(value: &mut Value) -> radix_engine_toolkit::Result<()> { - let mut visitor = ValueAliasingVisitor::default(); - traverse_value(value, &mut [&mut visitor]) -} diff --git a/schema/Cargo.toml b/schema/Cargo.toml index aa6aaa9f..e74736e6 100644 --- a/schema/Cargo.toml +++ b/schema/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "schema" -version = "0.8.0" +version = "0.9.0" edition = "2021" [dependencies] @@ -15,8 +15,8 @@ radix-engine-toolkit = { path = "../radix-engine-toolkit" } serde = "1.0.152" convert_case = "0.6.0" -sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } -scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } -scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6", package = "utils" } -native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6", package = "transaction" } -radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "betanet-v2-da72287e6" } \ No newline at end of file +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } +scrypto_utils = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148", package = "utils" } +native_transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148", package = "transaction" } +radix-engine-constants = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v1-71c24148" } \ No newline at end of file diff --git a/schema/out/examples/request-examples.md b/schema/out/examples/request-examples.md index 80abe252..d7e693bd 100644 --- a/schema/out/examples/request-examples.md +++ b/schema/out/examples/request-examples.md @@ -8,7 +8,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `information` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_information` | -| Functionality | The function provides information information on the currently in-use radix engine toolkit such as the version of the radix engine toolkit. In most cases, this is the first function written when integrating new clients; so, this function is often times seen as the "Hello World" example of the radix engine toolkit. | +| Functionality | The function provides information information on the currently in-use radix engine toolkit such as the version of the radix engine toolkit. In most cases, this is the first function written when integrating new clients; so, this function is often times seen as the "Hello World" example of the radix engine toolkit. | +| Required Features | default | | Request Type | `InformationRequest` | | Response Type | `InformationResponse` | @@ -25,8 +26,8 @@ This document contains examples and descriptions of the different requests and r ```json { - "package_version": "0.8.0", - "git_hash": "This is just an example. We don't have a commit hash here :)" + "package_version": "0.9.0", + "last_commit_hash": "This is just an example. We don't have a commit hash here" } ``` @@ -36,7 +37,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `convert_manifest` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_convertManifest` | -| Functionality | Clients have a need to be able to read, parse, understand, and interrogate transaction manifests to get more information on what a transactions might be doing. Transaction manifests have so far existed in one format: as strings. While the string format is very human readable, it is not easily readable by machines as a lexer and parser are needed to make sense of them; thus, it is for clients to programmatically make sense of transactions. As such, there is a need for another transaction manifest format (to supplement, NOT replace) which machines can easily make sense of without the need to implement a lexer and parser.

Therefore, this library introduces a Parsed format for transaction manifests which clients can use when wanting to read and interrogate their transaction manifests in code. The transaction manifest Parsed format has a 1:1 mapping to the string format of transaction manifests, meaning that anything which can be done in the string format of transaction manifests, can be done in the Parsed format as well.

This function allows the client the convert their manifest between the two supported manifest types: string and Parsed. | +| Functionality | Clients have a need to be able to read, parse, understand, and interrogate transaction manifests to get more information on what a transactions might be doing. Transaction manifests have so far existed in one format: as strings. While the string format is very human readable, it is not easily readable by machines as a lexer and parser are needed to make sense of them; thus, it is for clients to programmatically make sense of transactions. As such, there is a need for another transaction manifest format (to supplement, NOT replace) which machines can easily make sense of without the need to implement a lexer and parser.

Therefore, this library introduces a Parsed format for transaction manifests which clients can use when wanting to read and interrogate their transaction manifests in code. The transaction manifest Parsed format has a 1:1 mapping to the string format of transaction manifests, meaning that anything which can be done in the string format of transaction manifests, can be done in the Parsed format as well.

This function allows the client the convert their manifest between the two supported manifest types: string and Parsed. | +| Required Features | default | | Request Type | `ConvertManifestRequest` | | Response Type | `ConvertManifestResponse` | @@ -54,29 +56,29 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "withdraw_by_amount" + "value": "withdraw" }, "arguments": [ { - "type": "Decimal", - "value": "5" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Decimal", + "value": "5" } ] }, { "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -93,8 +95,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + "type": "Address", + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" }, "method_name": { "type": "String", @@ -113,8 +115,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -124,15 +126,15 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + "type": "Address", + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" } }, { "instruction": "TAKE_FROM_WORKTOP", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "into_bucket": { "type": "Bucket", @@ -142,101 +144,6 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "CREATE_PROOF_FROM_BUCKET", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket2" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" - }, - "method_name": { - "type": "String", - "value": "create_proof_by_amount" - }, - "arguments": [ - { - "type": "Decimal", - "value": "5" - }, - { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - } - ] - }, - { - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { @@ -250,8 +157,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "TAKE_FROM_WORKTOP_BY_IDS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "ids": [ { @@ -270,14 +177,11 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "DROP_ALL_PROOFS" - }, { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", @@ -309,29 +213,29 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "withdraw_by_amount" + "value": "withdraw" }, "arguments": [ { - "type": "Decimal", - "value": "5" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Decimal", + "value": "5" } ] }, { "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -348,8 +252,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + "type": "Address", + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" }, "method_name": { "type": "String", @@ -368,8 +272,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -379,15 +283,15 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + "type": "Address", + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" } }, { "instruction": "TAKE_FROM_WORKTOP", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "into_bucket": { "type": "Bucket", @@ -397,101 +301,6 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "CREATE_PROOF_FROM_BUCKET", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket2" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" - }, - "method_name": { - "type": "String", - "value": "create_proof_by_amount" - }, - "arguments": [ - { - "type": "Decimal", - "value": "5" - }, - { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - } - ] - }, - { - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { @@ -505,8 +314,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "TAKE_FROM_WORKTOP_BY_IDS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "ids": [ { @@ -525,14 +334,11 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "DROP_ALL_PROOFS" - }, { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", @@ -557,7 +363,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `analyze_manifest` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_analyzeManifest` | -| Functionality | Analyzes the manifest returning back all of the addresses involved in the manifest alongside some useful information on whether the accounts were withdrawn from, deposited into, or just used in the manifest in general. | +| Functionality | Analyzes the manifest returning back all of the addresses involved in the manifest alongside some useful information on whether the accounts were withdrawn from, deposited into, or just used in the manifest in general. | +| Required Features | default | | Request Type | `AnalyzeManifestRequest` | | Response Type | `AnalyzeManifestResponse` | @@ -570,7 +377,7 @@ This document contains examples and descriptions of the different requests and r "manifest": { "instructions": { "type": "String", - "value": "CALL_METHOD\n ComponentAddress(\"account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064\")\n \"withdraw_by_amount\"\n Decimal(\"5\")\n ResourceAddress(\"resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag\");\nTAKE_FROM_WORKTOP_BY_AMOUNT\n Decimal(\"2\")\n ResourceAddress(\"resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag\")\n Bucket(\"bucket1\");\nCALL_METHOD\n ComponentAddress(\"component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum\")\n \"buy_gumball\"\n Bucket(\"bucket1\");\nASSERT_WORKTOP_CONTAINS_BY_AMOUNT\n Decimal(\"3\")\n ResourceAddress(\"resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag\");\nASSERT_WORKTOP_CONTAINS\n ResourceAddress(\"resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6\");\nTAKE_FROM_WORKTOP\n ResourceAddress(\"resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag\")\n Bucket(\"bucket2\");\nCREATE_PROOF_FROM_BUCKET\n Bucket(\"bucket2\")\n Proof(\"proof1\");\nCLONE_PROOF\n Proof(\"proof1\")\n Proof(\"proof2\");\nDROP_PROOF\n Proof(\"proof1\");\nDROP_PROOF\n Proof(\"proof2\");\nCALL_METHOD\n ComponentAddress(\"account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064\")\n \"create_proof_by_amount\"\n Decimal(\"5\")\n ResourceAddress(\"resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag\");\nPOP_FROM_AUTH_ZONE\n Proof(\"proof3\");\nDROP_PROOF\n Proof(\"proof3\");\nRETURN_TO_WORKTOP\n Bucket(\"bucket2\");\nTAKE_FROM_WORKTOP_BY_IDS\n Array(NonFungibleLocalId(\"#1#\"))\n ResourceAddress(\"resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag\")\n Bucket(\"bucket3\");\nDROP_ALL_PROOFS;\nCALL_METHOD\n ComponentAddress(\"account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064\")\n \"deposit_batch\"\n Expression(\"ENTIRE_WORKTOP\");\n" + "value": "CALL_METHOD\n Address(\"account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn\")\n \"withdraw\"\n Address(\"resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k\")\n Decimal(\"5\");\nTAKE_FROM_WORKTOP_BY_AMOUNT\n Decimal(\"2\")\n Address(\"resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k\")\n Bucket(\"bucket1\");\nCALL_METHOD\n Address(\"component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn\")\n \"buy_gumball\"\n Bucket(\"bucket1\");\nASSERT_WORKTOP_CONTAINS_BY_AMOUNT\n Decimal(\"3\")\n Address(\"resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k\");\nASSERT_WORKTOP_CONTAINS\n Address(\"resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe\");\nTAKE_FROM_WORKTOP\n Address(\"resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k\")\n Bucket(\"bucket2\");\nRETURN_TO_WORKTOP\n Bucket(\"bucket2\");\nTAKE_FROM_WORKTOP_BY_IDS\n Array(NonFungibleLocalId(\"#1#\"))\n Address(\"resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k\")\n Bucket(\"bucket3\");\nCALL_METHOD\n Address(\"account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn\")\n \"deposit_batch\"\n Expression(\"ENTIRE_WORKTOP\");\n" }, "blobs": [] } @@ -587,45 +394,45 @@ This document contains examples and descriptions of the different requests and r "component_addresses": [ { "type": "ComponentAddress", - "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" }, { "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" } ], "resource_addresses": [ { "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, { "type": "ResourceAddress", - "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" } ], "account_addresses": [ { "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" } ], "accounts_requiring_auth": [ { "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" } ], "accounts_withdrawn_from": [ { "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" } ], "accounts_deposited_into": [ { "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" } ] } @@ -637,7 +444,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `compile_transaction_intent` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_compileTransactionIntent` | -| Functionality | Takes a transaction intent and compiles it by SBOR encoding it and returning it back to the caller. This is mainly useful when creating a transaction. | +| Functionality | Takes a transaction intent and compiles it by SBOR encoding it and returning it back to the caller. This is mainly useful when creating a transaction. | +| Required Features | default | | Request Type | `CompileTransactionIntentRequest` | | Response Type | `CompileTransactionIntentResponse` | @@ -667,29 +475,29 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "withdraw_by_amount" + "value": "withdraw" }, "arguments": [ { - "type": "Decimal", - "value": "5" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Decimal", + "value": "5" } ] }, { "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -706,8 +514,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + "type": "Address", + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" }, "method_name": { "type": "String", @@ -726,8 +534,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -737,15 +545,15 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + "type": "Address", + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" } }, { "instruction": "TAKE_FROM_WORKTOP", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "into_bucket": { "type": "Bucket", @@ -755,101 +563,6 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "CREATE_PROOF_FROM_BUCKET", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket2" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" - }, - "method_name": { - "type": "String", - "value": "create_proof_by_amount" - }, - "arguments": [ - { - "type": "Decimal", - "value": "5" - }, - { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - } - ] - }, - { - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { @@ -863,8 +576,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "TAKE_FROM_WORKTOP_BY_IDS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "ids": [ { @@ -883,14 +596,11 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "DROP_ALL_PROOFS" - }, { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", @@ -916,7 +626,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" + "compiled_intent": "4d21022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f626174636821018300202000" } ``` @@ -926,7 +636,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `decompile_transaction_intent` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_decompileTransactionIntent` | -| Functionality | This function does the opposite of the compile_transaction_intent function. It takes in a compiled transaction intent and decompiles it into its human-readable / machine-readable format. | +| Functionality | This function does the opposite of the compile_transaction_intent function. It takes in a compiled transaction intent and decompiles it into its human-readable / machine-readable format. | +| Required Features | default | | Request Type | `DecompileTransactionIntentRequest` | | Response Type | `DecompileTransactionIntentResponse` | @@ -936,7 +647,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_intent": "5c21022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a200202000" + "compiled_intent": "4d21022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f626174636821018300202000" } ``` @@ -967,29 +678,29 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "withdraw_by_amount" + "value": "withdraw" }, "arguments": [ { - "type": "Decimal", - "value": "5" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Decimal", + "value": "5" } ] }, { "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -1006,8 +717,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + "type": "Address", + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" }, "method_name": { "type": "String", @@ -1026,8 +737,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -1037,15 +748,15 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + "type": "Address", + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" } }, { "instruction": "TAKE_FROM_WORKTOP", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "into_bucket": { "type": "Bucket", @@ -1056,150 +767,52 @@ This document contains examples and descriptions of the different requests and r } }, { - "instruction": "CREATE_PROOF_FROM_BUCKET", + "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", "identifier": { "type": "String", "value": "bucket2" } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } } }, { - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", + ], + "into_bucket": { + "type": "Bucket", "identifier": { "type": "String", - "value": "proof2" + "value": "bucket3" } } }, { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "create_proof_by_amount" + "value": "deposit_batch" }, "arguments": [ { - "type": "Decimal", - "value": "5" - }, - { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - } - ] - }, - { - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "RETURN_TO_WORKTOP", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket2" - } - } - }, - { - "instruction": "TAKE_FROM_WORKTOP_BY_IDS", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - }, - "ids": [ - { - "type": "NonFungibleLocalId", - "value": { - "type": "Integer", - "value": "1" - } - } - ], - "into_bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket3" - } - } - }, - { - "instruction": "DROP_ALL_PROOFS" - }, - { - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" - }, - "method_name": { - "type": "String", - "value": "deposit_batch" - }, - "arguments": [ - { - "type": "Expression", - "value": "ENTIRE_WORKTOP" + "type": "Expression", + "value": "ENTIRE_WORKTOP" } ] } @@ -1216,7 +829,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `compile_signed_transaction_intent` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_compileSignedTransactionIntent` | -| Functionality | This function takes in a raw transaction intent as well as its signatures and compiles it. This is useful when a notary wishes to notarize a signed transaction intent. | +| Functionality | This function takes in a raw transaction intent as well as its signatures and compiles it. This is useful when a notary wishes to notarize a signed transaction intent. | +| Required Features | default | | Request Type | `CompileSignedTransactionIntentRequest` | | Response Type | `CompileSignedTransactionIntentResponse` | @@ -1247,29 +861,29 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "withdraw_by_amount" + "value": "withdraw" }, "arguments": [ { - "type": "Decimal", - "value": "5" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Decimal", + "value": "5" } ] }, { "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -1286,8 +900,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + "type": "Address", + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" }, "method_name": { "type": "String", @@ -1306,8 +920,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -1317,15 +931,15 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + "type": "Address", + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" } }, { "instruction": "TAKE_FROM_WORKTOP", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "into_bucket": { "type": "Bucket", @@ -1335,101 +949,6 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "CREATE_PROOF_FROM_BUCKET", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket2" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" - }, - "method_name": { - "type": "String", - "value": "create_proof_by_amount" - }, - "arguments": [ - { - "type": "Decimal", - "value": "5" - }, - { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - } - ] - }, - { - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { @@ -1443,8 +962,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "TAKE_FROM_WORKTOP_BY_IDS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "ids": [ { @@ -1463,14 +982,11 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "DROP_ALL_PROOFS" - }, { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", @@ -1491,30 +1007,30 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "00a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa" + "signature": "001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a74" }, { "curve": "EcdsaSecp256k1", - "signature": "0133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e" + "signature": "008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0" }, { "curve": "EcdsaSecp256k1", - "signature": "01578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e8" + "signature": "0075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c08" + "signature": "2a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be198951504" + "signature": "7eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f21801" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" + "signature": "c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d" } ] } @@ -1526,7 +1042,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" + "compiled_intent": "4d210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d" } ``` @@ -1536,7 +1052,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `decompile_signed_transaction_intent` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_decompileSignedTransactionIntent` | -| Functionality | This function does the opposite of the compile_signed_transaction_intent function. This function takes in a compiled signed transaction intent and decompiles it into its transaction intent and signatures. | +| Functionality | This function does the opposite of the compile_signed_transaction_intent function. This function takes in a compiled signed transaction intent and decompiles it into its transaction intent and signatures. | +| Required Features | default | | Request Type | `DecompileSignedTransactionIntentRequest` | | Response Type | `DecompileSignedTransactionIntentResponse` | @@ -1546,7 +1063,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_signed_intent": "5c210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" + "compiled_signed_intent": "4d210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d" } ``` @@ -1578,29 +1095,29 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "withdraw_by_amount" + "value": "withdraw" }, "arguments": [ { - "type": "Decimal", - "value": "5" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Decimal", + "value": "5" } ] }, { "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -1617,8 +1134,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + "type": "Address", + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" }, "method_name": { "type": "String", @@ -1637,8 +1154,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -1648,15 +1165,15 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + "type": "Address", + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" } }, { "instruction": "TAKE_FROM_WORKTOP", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "into_bucket": { "type": "Bucket", @@ -1666,101 +1183,6 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "CREATE_PROOF_FROM_BUCKET", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket2" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" - }, - "method_name": { - "type": "String", - "value": "create_proof_by_amount" - }, - "arguments": [ - { - "type": "Decimal", - "value": "5" - }, - { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - } - ] - }, - { - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { @@ -1774,8 +1196,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "TAKE_FROM_WORKTOP_BY_IDS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "ids": [ { @@ -1794,14 +1216,11 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "DROP_ALL_PROOFS" - }, { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", @@ -1822,30 +1241,30 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "00a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa" + "signature": "001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a74" }, { "curve": "EcdsaSecp256k1", - "signature": "0133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e" + "signature": "008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0" }, { "curve": "EcdsaSecp256k1", - "signature": "01578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e8" + "signature": "0075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c08" + "signature": "2a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be198951504" + "signature": "7eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f21801" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" + "signature": "c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d" } ] } @@ -1857,7 +1276,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `compile_notarized_transaction` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_compileNotarizedTransaction` | -| Functionality | This function takes in a raw signed transaction intent as well as the notary signature and compiles it. This is useful when we wish to submit a transaction to the Gateway API | +| Functionality | This function takes in a raw signed transaction intent as well as the notary signature and compiles it. This is useful when we wish to submit a transaction to the Gateway API | +| Required Features | default | | Request Type | `CompileNotarizedTransactionRequest` | | Response Type | `CompileNotarizedTransactionResponse` | @@ -1889,29 +1309,29 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "withdraw_by_amount" + "value": "withdraw" }, "arguments": [ { - "type": "Decimal", - "value": "5" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Decimal", + "value": "5" } ] }, { "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -1928,8 +1348,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + "type": "Address", + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" }, "method_name": { "type": "String", @@ -1948,8 +1368,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -1959,15 +1379,15 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + "type": "Address", + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" } }, { "instruction": "TAKE_FROM_WORKTOP", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "into_bucket": { "type": "Bucket", @@ -1978,150 +1398,52 @@ This document contains examples and descriptions of the different requests and r } }, { - "instruction": "CREATE_PROOF_FROM_BUCKET", + "instruction": "RETURN_TO_WORKTOP", "bucket": { "type": "Bucket", "identifier": { "type": "String", "value": "bucket2" } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } } }, { - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", + ], + "into_bucket": { + "type": "Bucket", "identifier": { "type": "String", - "value": "proof2" + "value": "bucket3" } } }, { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "create_proof_by_amount" + "value": "deposit_batch" }, "arguments": [ { - "type": "Decimal", - "value": "5" - }, - { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - } - ] - }, - { - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "RETURN_TO_WORKTOP", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket2" - } - } - }, - { - "instruction": "TAKE_FROM_WORKTOP_BY_IDS", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - }, - "ids": [ - { - "type": "NonFungibleLocalId", - "value": { - "type": "Integer", - "value": "1" - } - } - ], - "into_bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket3" - } - } - }, - { - "instruction": "DROP_ALL_PROOFS" - }, - { - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" - }, - "method_name": { - "type": "String", - "value": "deposit_batch" - }, - "arguments": [ - { - "type": "Expression", - "value": "ENTIRE_WORKTOP" + "type": "Expression", + "value": "ENTIRE_WORKTOP" } ] } @@ -2133,36 +1455,36 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "00a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa" + "signature": "001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a74" }, { "curve": "EcdsaSecp256k1", - "signature": "0133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e" + "signature": "008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0" }, { "curve": "EcdsaSecp256k1", - "signature": "01578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e8" + "signature": "0075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c08" + "signature": "2a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be198951504" + "signature": "7eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f21801" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" + "signature": "c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d" } ] }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": "0161d5430b6d8051ed9b4a68e96cedd25594afb3da0d8fdcbb5783faffbce188185345bbd0eefb743860614be4184a2c2d5374fd71c7cbb8422b38f89e9c79fd00" + "signature": "005f9290847274a47ce592718db3b1d7ace56db9fbcbc9139cd9e680715f7a316a535cccd292b1176e8d25a2b5dfc6907fc0527c8f5bd36db750a02972945bc6d7" } } ``` @@ -2173,7 +1495,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d220001b20161d5430b6d8051ed9b4a68e96cedd25594afb3da0d8fdcbb5783faffbce188185345bbd0eefb743860614be4184a2c2d5374fd71c7cbb8422b38f89e9c79fd00" + "compiled_intent": "4d2102210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d2200012101200741005f9290847274a47ce592718db3b1d7ace56db9fbcbc9139cd9e680715f7a316a535cccd292b1176e8d25a2b5dfc6907fc0527c8f5bd36db750a02972945bc6d7" } ``` @@ -2183,7 +1505,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `decompile_notarized_transaction` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_decompileNotarizedTransaction` | -| Functionality | This function does the opposite of the compile_notarized_intent()_intent function. This function takes in a compiled notarized transaction intent and decompiles it into its signed transaction intent and notary signature. | +| Functionality | This function does the opposite of the compile_notarized_intent()_intent function. This function takes in a compiled notarized transaction intent and decompiles it into its signed transaction intent and notary signature. | +| Required Features | default | | Request Type | `DecompileNotarizedTransactionRequest` | | Response Type | `DecompileNotarizedTransactionResponse` | @@ -2193,7 +1516,7 @@ This document contains examples and descriptions of the different requests and r ```json { "instructions_output_kind": "Parsed", - "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d220001b20161d5430b6d8051ed9b4a68e96cedd25594afb3da0d8fdcbb5783faffbce188185345bbd0eefb743860614be4184a2c2d5374fd71c7cbb8422b38f89e9c79fd00" + "compiled_notarized_intent": "4d2102210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d2200012101200741005f9290847274a47ce592718db3b1d7ace56db9fbcbc9139cd9e680715f7a316a535cccd292b1176e8d25a2b5dfc6907fc0527c8f5bd36db750a02972945bc6d7" } ``` @@ -2226,29 +1549,29 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", - "value": "withdraw_by_amount" + "value": "withdraw" }, "arguments": [ { - "type": "Decimal", - "value": "5" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Decimal", + "value": "5" } ] }, { "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -2265,8 +1588,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "component_sim1q2f9vmyrmeladvz0ejfttcztqv3genlsgpu9vue83mcs835hum" + "type": "Address", + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" }, "method_name": { "type": "String", @@ -2285,8 +1608,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "amount": { "type": "Decimal", @@ -2296,15 +1619,15 @@ This document contains examples and descriptions of the different requests and r { "instruction": "ASSERT_WORKTOP_CONTAINS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qzhdk7tq68u8msj38r6v6yqa5myc64ejx3ud20zlh9gseqtux6" + "type": "Address", + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" } }, { "instruction": "TAKE_FROM_WORKTOP", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "into_bucket": { "type": "Bucket", @@ -2314,101 +1637,6 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "CREATE_PROOF_FROM_BUCKET", - "bucket": { - "type": "Bucket", - "identifier": { - "type": "String", - "value": "bucket2" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "CLONE_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - }, - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof1" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof2" - } - } - }, - { - "instruction": "CALL_METHOD", - "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" - }, - "method_name": { - "type": "String", - "value": "create_proof_by_amount" - }, - "arguments": [ - { - "type": "Decimal", - "value": "5" - }, - { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" - } - ] - }, - { - "instruction": "POP_FROM_AUTH_ZONE", - "into_proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, - { - "instruction": "DROP_PROOF", - "proof": { - "type": "Proof", - "identifier": { - "type": "String", - "value": "proof3" - } - } - }, { "instruction": "RETURN_TO_WORKTOP", "bucket": { @@ -2422,8 +1650,8 @@ This document contains examples and descriptions of the different requests and r { "instruction": "TAKE_FROM_WORKTOP_BY_IDS", "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqu57yag" + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" }, "ids": [ { @@ -2442,14 +1670,11 @@ This document contains examples and descriptions of the different requests and r } } }, - { - "instruction": "DROP_ALL_PROOFS" - }, { "instruction": "CALL_METHOD", "component_address": { - "type": "ComponentAddress", - "address": "account_sim1q02r73u7nv47h80e30pc3q6ylsj7mgvparm3pnsm780qgsy064" + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" }, "method_name": { "type": "String", @@ -2470,57 +1695,58 @@ This document contains examples and descriptions of the different requests and r "intent_signatures": [ { "curve": "EcdsaSecp256k1", - "signature": "00a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa" + "signature": "001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a74" }, { "curve": "EcdsaSecp256k1", - "signature": "0133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e" + "signature": "008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0" }, { "curve": "EcdsaSecp256k1", - "signature": "01578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e8" + "signature": "0075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e" }, { "curve": "EddsaEd25519", "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c08" + "signature": "2a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a" }, { "curve": "EddsaEd25519", "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", - "signature": "630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be198951504" + "signature": "7eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f21801" }, { "curve": "EddsaEd25519", "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", - "signature": "e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d" + "signature": "c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d" } ] }, "notary_signature": { "curve": "EcdsaSecp256k1", - "signature": "0161d5430b6d8051ed9b4a68e96cedd25594afb3da0d8fdcbb5783faffbce188185345bbd0eefb743860614be4184a2c2d5374fd71c7cbb8422b38f89e9c79fd00" + "signature": "005f9290847274a47ce592718db3b1d7ace56db9fbcbc9139cd9e680715f7a316a535cccd292b1176e8d25a2b5dfc6907fc0527c8f5bd36db750a02972945bc6d7" } } ``` -## Encode Address +## Decompile Unknown Transaction Intent -| Function Name | `encode_address` | +| Function Name | `decompile_unknown_transaction_intent` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_encodeAddress` | -| Functionality | This function can be used when we have a byte array which we wish to do Bech32m encoding on. In this case, the HRP to use will be determined through the entity byte of the passed address hex string. | -| Request Type | `EncodeAddressRequest` | -| Response Type | `EncodeAddressResponse` | +| JNI Function Name | `Java_RadixEngineToolkitFFI_decompileUnknownTransactionIntent` | +| Functionality | There are certain cases where we might have some blob which we suspect is a transaction intent but we have no way of verifying whether that is true or not. Looking at the type id byte of the blob does not help either as it's a generic Struct type which is not too telling. For this specific use case, this library provides this function which attempts to decompile a transaction intent of an unknown type. | +| Required Features | default | +| Request Type | `DecompileUnknownTransactionIntentRequest` | +| Response Type | `DecompileUnknownTransactionIntentResponse` |
Request Example ```json { - "address_bytes": "000000000000000000000000000000000000000000000000000002", - "network_id": "242" + "instructions_output_kind": "Parsed", + "compiled_unknown_intent": "4d2102210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d2200012101200741005f9290847274a47ce592718db3b1d7ace56db9fbcbc9139cd9e680715f7a316a535cccd292b1176e8d25a2b5dfc6907fc0527c8f5bd36db750a02972945bc6d7" } ```
@@ -2530,27 +1756,230 @@ This document contains examples and descriptions of the different requests and r ```json { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz" + "type": "NotarizedTransactionIntent", + "value": { + "signed_intent": { + "intent": { + "header": { + "version": "1", + "network_id": "242", + "start_epoch_inclusive": "512", + "end_epoch_exclusive": "528", + "nonce": "34", + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" + }, + "notary_as_signatory": true, + "cost_unit_limit": "100000000", + "tip_percentage": "0" + }, + "manifest": { + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" + }, + "method_name": { + "type": "String", + "value": "withdraw" + }, + "arguments": [ + { + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" + }, + { + "type": "Decimal", + "value": "5" + } + ] + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "resource_address": { + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" + }, + "amount": { + "type": "Decimal", + "value": "2" + }, + "into_bucket": { + "type": "Bucket", + "identifier": { + "type": "String", + "value": "bucket1" + } + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "Address", + "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" + }, + "method_name": { + "type": "String", + "value": "buy_gumball" + }, + "arguments": [ + { + "type": "Bucket", + "identifier": { + "type": "String", + "value": "bucket1" + } + } + ] + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" + }, + "amount": { + "type": "Decimal", + "value": "3" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "type": "Address", + "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "resource_address": { + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" + }, + "into_bucket": { + "type": "Bucket", + "identifier": { + "type": "String", + "value": "bucket2" + } + } + }, + { + "instruction": "RETURN_TO_WORKTOP", + "bucket": { + "type": "Bucket", + "identifier": { + "type": "String", + "value": "bucket2" + } + } + }, + { + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "resource_address": { + "type": "Address", + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" + }, + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "into_bucket": { + "type": "Bucket", + "identifier": { + "type": "String", + "value": "bucket3" + } + } + }, + { + "instruction": "CALL_METHOD", + "component_address": { + "type": "Address", + "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" + }, + "method_name": { + "type": "String", + "value": "deposit_batch" + }, + "arguments": [ + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ] + } + ] + }, + "blobs": [] + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a74" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e" + }, + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "2a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "7eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f21801" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d" + } + ] + }, + "notary_signature": { + "curve": "EcdsaSecp256k1", + "signature": "005f9290847274a47ce592718db3b1d7ace56db9fbcbc9139cd9e680715f7a316a535cccd292b1176e8d25a2b5dfc6907fc0527c8f5bd36db750a02972945bc6d7" + } + } } ``` -## Decode Address +## Encode Address -| Function Name | `decode_address` | +| Function Name | `encode_address` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_decodeAddress` | -| Functionality | This function can be used to decode a Bech32m encoded address string into its equivalent hrp and data. In addition to that, this function provides other useful information on the address such as the network id and name that it is used for, and the entity type of the address. | -| Request Type | `DecodeAddressRequest` | -| Response Type | `DecodeAddressResponse` | +| JNI Function Name | `Java_RadixEngineToolkitFFI_encodeAddress` | +| Functionality | This function can be used when we have a byte array which we wish to do Bech32m encoding on. In this case, the HRP to use will be determined through the entity byte of the passed address hex string. | +| Required Features | default | +| Request Type | `EncodeAddressRequest` | +| Response Type | `EncodeAddressResponse` |
Request Example ```json { - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz" + "address_bytes": "000000000000000000000000000000000000000000000000000002", + "network_id": "242" } ```
@@ -2560,113 +1989,28 @@ This document contains examples and descriptions of the different requests and r ```json { - "network_id": "242", - "network_name": "simulator", - "entity_type": "Resource", - "data": "000000000000000000000000000000000000000000000000000002", - "hrp": "resource_sim" + "type": "PackageAddress", + "address": "package_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqmre2w5" } ``` -## Sbor Encode +## Decode Address -| Function Name | `sbor_encode` | +| Function Name | `decode_address` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_sborEncode` | -| Functionality | This function takes in a Value and encodes it in SBOR. | -| Request Type | `SborEncodeRequest` | -| Response Type | `SborEncodeResponse` | +| JNI Function Name | `Java_RadixEngineToolkitFFI_decodeAddress` | +| Functionality | This function can be used to decode a Bech32m encoded address string into its equivalent hrp and data. In addition to that, this function provides other useful information on the address such as the network id and name that it is used for, and the entity type of the address. | +| Required Features | default | +| Request Type | `DecodeAddressRequest` | +| Response Type | `DecodeAddressResponse` |
Request Example ```json { - "type": "Tuple", - "elements": [ - { - "type": "Decimal", - "value": "10" - }, - { - "type": "PreciseDecimal", - "value": "10" - }, - { - "type": "String", - "value": "Hello World!" - }, - { - "type": "Tuple", - "elements": [ - { - "type": "Decimal", - "value": "10" - }, - { - "type": "PreciseDecimal", - "value": "10" - }, - { - "type": "String", - "value": "Hello World!" - }, - { - "type": "Tuple", - "elements": [ - { - "type": "Decimal", - "value": "10" - }, - { - "type": "PreciseDecimal", - "value": "10" - }, - { - "type": "String", - "value": "Hello World!" - }, - { - "type": "Tuple", - "elements": [ - { - "type": "Decimal", - "value": "10" - }, - { - "type": "PreciseDecimal", - "value": "10" - }, - { - "type": "String", - "value": "Hello World!" - }, - { - "type": "Array", - "element_kind": "Decimal", - "elements": [ - { - "type": "Decimal", - "value": "20" - }, - { - "type": "Decimal", - "value": "100" - }, - { - "type": "Decimal", - "value": "192.31" - } - ] - } - ] - } - ] - } - ] - } - ] + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" } ```
@@ -2676,36 +2020,31 @@ This document contains examples and descriptions of the different requests and r ```json { - "encoded_value": "5c2104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c642120b5030000d01309468e15010000000000000000000000000000000000000000000000000010632d5ec76b05000000000000000000000000000000000000000000000000005f13195ed66c0a0000000000000000000000000000000000000000000000" + "network_id": "242", + "network_name": "simulator", + "entity_type": "FungibleResource", + "data": "010000000000000000000000000000000000000000000000000000", + "hrp": "resource_sim" } ``` -## Sbor Decode +## Sbor Encode -| Function Name | `sbor_decode` | +| Function Name | `sbor_encode` | | ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_sborDecode` | -| Functionality | This function takes in a hex string and attemps to decode it into a Value. | -| Request Type | `SborDecodeRequest` | -| Response Type | `SborDecodeResponse` | +| JNI Function Name | `Java_RadixEngineToolkitFFI_sborEncode` | +| Functionality | This function takes in a ScryptoSborValue and encodes it in SBOR. | +| Required Features | default | +| Request Type | `SborEncodeRequest` | +| Response Type | `SborEncodeResponse` |
Request Example ```json { - "encoded_value": "5c2104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104b50000e8890423c78a000000000000000000000000000000000000000000000000b600000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c642120b5030000d01309468e15010000000000000000000000000000000000000000000000000010632d5ec76b05000000000000000000000000000000000000000000000000005f13195ed66c0a0000000000000000000000000000000000000000000000", - "network_id": "242" -} -``` -
- -
- Response Example - -```json -{ + "type": "ScryptoSbor", "value": { "type": "Tuple", "elements": [ @@ -2796,12 +2135,102 @@ This document contains examples and descriptions of the different requests and r ```
+
+ Response Example + +```json +{ + "encoded_value": "5c2104a00000e8890423c78a000000000000000000000000000000000000000000000000b000000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104a00000e8890423c78a000000000000000000000000000000000000000000000000b000000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104a00000e8890423c78a000000000000000000000000000000000000000000000000b000000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c64212104a00000e8890423c78a000000000000000000000000000000000000000000000000b000000000000000000a36257aef45394e46ef8b8a90c37f1c2716f3000000000000000000000000000000000000000000000000000000000000000000000000000c0c48656c6c6f20576f726c642120a0030000d01309468e15010000000000000000000000000000000000000000000000000010632d5ec76b05000000000000000000000000000000000000000000000000005f13195ed66c0a0000000000000000000000000000000000000000000000" +} +``` +
+ +## Sbor Decode + +| Function Name | `sbor_decode` | +| ----------------- | :----------------- | +| JNI Function Name | `Java_RadixEngineToolkitFFI_sborDecode` | +| Functionality | This function takes in a hex string and attempts to decode it into a ScryptoSborValue. | +| Required Features | default | +| Request Type | `SborDecodeRequest` | +| Response Type | `SborDecodeResponse` | + +
+ Request Example + +```json +{ + "encoded_value": "4d210a8000000000000000000000000000000000000000000000000000000080010101010101010101010101010101010101010101010101010101800202020202020202020202020202020202020202020202020202028104000000820500000083018406060606060606060606060606060606060606060606060606060606060606068507070707070707070707070707070707070707070707070707070707070707078608080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808080808870003616263", + "network_id": "242" +} +``` +
+ +
+ Response Example + +```json +{ + "type": "ManifestSbor", + "value": { + "type": "Tuple", + "elements": [ + { + "type": "Address", + "address": "package_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq57ks9j" + }, + { + "type": "Address", + "address": "resource_sim1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszjakjx" + }, + { + "type": "Address", + "address": "resource_sim1qgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqg79t2z" + }, + { + "type": "Bucket", + "identifier": "4" + }, + { + "type": "Proof", + "identifier": "5" + }, + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Blob", + "hash": "0606060606060606060606060606060606060606060606060606060606060606" + }, + { + "type": "Decimal", + "value": "3178606371220444580254889784552217078325058402586211561867.463090413301597959" + }, + { + "type": "PreciseDecimal", + "value": "42063711152761088939840078425743830988170559437152606675211173156774161662975833652711762.5040530303613804921041144660418941298284296362978711643890386952" + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "abc" + } + } + ] + } +} +``` +
+ ## Derive Virtual Account Address | Function Name | `derive_virtual_account_address` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_deriveVirtualAccountAddress` | -| Functionality | Derives the virtual account component address given a public key and a network id. | +| Functionality | Derives the virtual account component address given a public key and a network id. | +| Required Features | default | | Request Type | `DeriveVirtualAccountAddressRequest` | | Response Type | `DeriveVirtualAccountAddressResponse` | @@ -2826,7 +2255,7 @@ This document contains examples and descriptions of the different requests and r { "virtual_account_address": { "type": "ComponentAddress", - "address": "account_sim1qupveqrdmh7kw0vefxrzjw5e0fgw3sgdj4zrh66jkphqj9h5gl" + "address": "account_sim1ppkfdmv0q2cwz9cjxk5t8u0zx6pdydd9p2jv22nuwdhqyn4rgj" } } ``` @@ -2837,7 +2266,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `derive_virtual_identity_address` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_deriveVirtualIdentityAddress` | -| Functionality | Derives the virtual identity component address given a public key and a network id. | +| Functionality | Derives the virtual identity component address given a public key and a network id. | +| Required Features | default | | Request Type | `DeriveVirtualIdentityAddressRequest` | | Response Type | `DeriveVirtualIdentityAddressResponse` | @@ -2862,7 +2292,45 @@ This document contains examples and descriptions of the different requests and r { "virtual_identity_address": { "type": "ComponentAddress", - "address": "identity_sim1pgpveqrdmh7kw0vefxrzjw5e0fgw3sgdj4zrh66jkphq06jcsf" + "address": "identity_sim1pdkfdmv0q2cwz9cjxk5t8u0zx6pdydd9p2jv22nuwdhqkcvkcq" + } +} +``` + + +## Derive Babylon Address From Olympia Address + +| Function Name | `derive_babylon_address_from_olympia_address` | +| ----------------- | :----------------- | +| JNI Function Name | `Java_RadixEngineToolkitFFI_deriveBabylonAddressFromOlympiaAddress` | +| Functionality | Derives the Babylon account address associated with the given Olympia account address | +| Required Features | default | +| Request Type | `DeriveBabylonAddressFromOlympiaAddressRequest` | +| Response Type | `DeriveBabylonAddressFromOlympiaAddressResponse` | + +
+ Request Example + +```json +{ + "network_id": "1", + "olympia_account_address": "rdx1qspx7zxmnrh36q33av24srdfzg7m3cj65968erpjuh7ja3rm3kmn6hq4j9842" +} +``` +
+ +
+ Response Example + +```json +{ + "babylon_account_address": { + "type": "ComponentAddress", + "address": "account_rdx1pzg7l46zndnsluatt7dvyvvjuynzal3wa8rylqggh8xsq5pwrq" + }, + "public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "026f08db98ef1d0231eb15580da9123db8e25aa1747c8c32e5fd2ec47b8db73d5c" } } ``` @@ -2873,7 +2341,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `derive_non_fungible_global_id_from_public_key` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_deriveNonFungibleGlobalIdFromPublicKey` | -| Functionality | Derives the non-fungible global id of the virtual badge associated with a given public key | +| Functionality | Derives the non-fungible global id of the virtual badge associated with a given public key | +| Required Features | default | | Request Type | `DeriveNonFungibleGlobalIdFromPublicKeyRequest` | | Response Type | `DeriveNonFungibleGlobalIdFromPublicKeyResponse` | @@ -2896,16 +2365,14 @@ This document contains examples and descriptions of the different requests and r ```json { - "type": "NonFungibleGlobalId", - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqshxgp7h" - }, - "non_fungible_local_id": { - "type": "NonFungibleLocalId", - "value": { + "non_fungible_global_id": { + "resource_address": { + "type": "ResourceAddress", + "address": "resource_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq056vhf" + }, + "non_fungible_local_id": { "type": "Bytes", - "value": "02cc806dddfd673d994986293a997a50e8c10d95443beb52b06e" + "value": "6c96ed8f02b0e1171235a8b3f1e23682d235a50aa4c52a7c736e" } } } @@ -2917,7 +2384,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `statically_validate_transaction` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_staticallyValidateTransaction` | -| Functionality | Performs static validation on the given notarized transaction. | +| Functionality | Performs static validation on the given notarized transaction. | +| Required Features | default | | Request Type | `StaticallyValidateTransactionRequest` | | Response Type | `StaticallyValidateTransactionResponse` | @@ -2926,7 +2394,7 @@ This document contains examples and descriptions of the different requests and r ```json { - "compiled_notarized_intent": "5c2102210221022109070107f20a00020000000000000a10020000000000000a2200000000000000220001b103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f505080000210220221127038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c1277697468647261775f62795f616d6f756e742007405c2102b50000f44482916345000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000040102b50000c84e676dc11b000000000000000000000000000000000000000000000000820000000000000000000000000000000000000000000000000000042703810292566c83de7fd6b04fcc92b5e04b03228ccff040785673278ef10c0b6275795f67756d62616c6c2007085c2101a0000000000502b500002cf61a24a2290000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000404018200aedb7960d1f87dc25138f4cd101da6c98d57323478d53c5fb9510001820000000000000000000000000000000000000000000000000000040d01a0010000000e01a1020000000f01a1020000000f01a10300000027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c166372656174655f70726f6f665f62795f616d6f756e742007405c2102b50000f444829163450000000000000000000000000000000000000000000000008200000000000000000000000000000000000000000000000000000407000f01a1040000000301a001000000020220b70101000000000000000182000000000000000000000000000000000000000000000000000004100027038103d43f479e9b2beb9df98bc3888344fc25eda181e8f710ce1bf1de0c0d6465706f7369745f62617463682007055c2101a2002020002022060001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa0001b20133a742dae4e19a372bfa792fb6176f1516cf9b336c2411138e7b15e5ebaefb2045487a0578b22848a4f86602212a214d443c7ae3dcc04e787b7319ca177ae61e0001b201578ce40c9829b82c95f837f1b28cc2acedc43119f8fb01b978067ca2cbc5b5db73240d1cb39362bf68c4da25ec35c4a88ba58b5dd608b1204a5f35102985e9e80102b34cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29b4623fefe903d3c9bab8462221c6cfd5e9c0c35cf4676717897049acc22b5ff42cbb89ed33d9647ff81ac5ec8a8bbbb99e33b6b0dd4ddbbf2c18ef1285ee666c080102b37422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674b4630908f90628964394cb6252b3eebb2ac635f5a09f7b658b183022292de097ce579fac4b532adc7284da45fd52a81a257153d67af20d38a18c600be1989515040102b3f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54bb4e3fe9ddf453096b36448624e2bfb55b8a8dcb7d2ebd3fd8704c9923c72e14e5958d79c69b8b81319b9a2eb95f38044bee8efbacbc50abe5765694c740a8fc10d220001b200a9b850915b885064d78f2e03ca727e30b4df39a005ee9656db09c233a74821e77948c22817bffc000ba375aefeb37b13ad9d2648f92a9efe34ebf3c3a74a30aa", + "compiled_notarized_intent": "4d2102210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d2200012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a74", "validation_config": { "network_id": "242", "min_cost_unit_limit": "1000000", @@ -2955,7 +2423,8 @@ This document contains examples and descriptions of the different requests and r | Function Name | `known_entity_addresses` | | ----------------- | :----------------- | | JNI Function Name | `Java_RadixEngineToolkitFFI_knownEntityAddresses` | -| Functionality | Given a network id, this function derives the Bech32m-encoded addresses of the set of known addresses.

As an example, this function allows users to derive the XRD resource address, faucet component address, or account package address on any network (given that they know its network id). | +| Functionality | Given a network id, this function derives the Bech32m-encoded addresses of the set of known addresses.

As an example, this function allows users to derive the XRD resource address, faucet component address, or account package address on any network (given that they know its network id). | +| Required Features | default | | Request Type | `KnownEntityAddressesRequest` | | Response Type | `KnownEntityAddressesResponse` | @@ -2976,44 +2445,74 @@ This document contains examples and descriptions of the different requests and r { "faucet_component_address": { "type": "ComponentAddress", - "address": "component_rdx1qgehpqdhhr62xh76wh6gppnyn88a0uau68epljprvj3sq5kftu" + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve" }, "faucet_package_address": { "type": "PackageAddress", - "address": "package_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqp7hql" + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4" }, "account_package_address": { "type": "PackageAddress", - "address": "package_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs4qk04v" + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzsew9vdj" }, "xrd_resource_address": { "type": "ResourceAddress", - "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqy99qqm" + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf" }, "system_token_resource_address": { "type": "ResourceAddress", - "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqps7ezz7w" + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqxts0hs" }, "ecdsa_secp256k1_token_resource_address": { "type": "ResourceAddress", - "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs3ydc4g" + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk" }, "eddsa_ed25519_token_resource_address": { "type": "ResourceAddress", - "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqtc26ta" + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsuhhdf9" }, "package_token_resource_address": { "type": "ResourceAddress", - "address": "resource_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzq6kmakh" + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpsn2chzr" }, "epoch_manager_system_address": { "type": "ComponentAddress", - "address": "epochmanager_rdx1qsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq2xdjnl" + "address": "epochmanager_rdx1q5qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqcmqvad" }, "clock_system_address": { "type": "ComponentAddress", - "address": "clock_rdx1qcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqm2y56s" + "address": "clock_rdx1quqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfhf25z" } } ```
+ +## Hash + +| Function Name | `hash` | +| ----------------- | :----------------- | +| JNI Function Name | `Java_RadixEngineToolkitFFI_hash` | +| Functionality | Hashes some payload through the hashing algorithm used in Scrypto and the Radix Engine. | +| Required Features | default | +| Request Type | `HashRequest` | +| Response Type | `HashResponse` | + +
+ Request Example + +```json +{ + "payload": "4d2102210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d2200012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a74" +} +``` +
+ +
+ Response Example + +```json +{ + "value": "87a708b4c71fcbf0cfddf4d6f31e099c52eb07eb9a3d4a5f9c23bb27f34be944" +} +``` +
diff --git a/schema/out/schema/analyze_manifest_request.json b/schema/out/schema/analyze_manifest_request.json index 04743b1e..e2f21235 100644 --- a/schema/out/schema/analyze_manifest_request.json +++ b/schema/out/schema/analyze_manifest_request.json @@ -14,7 +14,7 @@ "pattern": "[0-9]+" }, "manifest": { - "description": "The manifest to convert to the format described by `instructions_output_kind`", + "description": "The manifest to analyze.", "allOf": [ { "$ref": "#/definitions/TransactionManifest" @@ -25,6 +25,15 @@ "definitions": { "TransactionManifest": { "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -52,6 +61,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -70,6 +85,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -97,6 +122,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -112,43 +223,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -163,35 +334,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -206,18 +407,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -225,6 +426,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -240,26 +479,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -267,6 +506,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -282,15 +569,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -298,10 +585,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -309,6 +596,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -325,7 +624,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -333,6 +632,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -346,10 +661,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -357,6 +672,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -371,18 +710,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -390,6 +729,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -404,15 +777,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -423,6 +796,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -436,10 +821,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -447,6 +832,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -460,10 +857,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -471,6 +868,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -484,8 +886,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -500,18 +952,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -519,6 +971,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -534,26 +1024,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -561,6 +1051,54 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -576,15 +1114,15 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -592,10 +1130,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -603,6 +1141,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -617,18 +1174,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -636,6 +1193,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -650,18 +1226,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -669,6 +1245,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -682,10 +1270,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -693,6 +1281,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -708,14 +1301,82 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } + } + ], "type": "object", "required": [ - "abi", "access_rules", "code", "instruction", "metadata", - "royalty_config" + "royalty_config", + "schema" ], "properties": { "instruction": { @@ -725,108 +1386,78 @@ ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ - "abi", - "code", - "instruction", - "owner_badge" + "bucket", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - } - } - }, - { - "description": "An instruction to burn a bucket of tokens.", - "type": "object", - "required": [ - "bucket", - "instruction" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "BURN_RESOURCE" + "BURN_RESOURCE" ] }, "bucket": { "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -834,6 +1465,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -851,15 +1495,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -867,6 +1511,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -885,23 +1564,69 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -909,6 +1634,21 @@ }, { "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], "type": "object", "required": [ "instruction", @@ -923,18 +1663,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -942,6 +1682,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -956,18 +1720,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -975,6 +1739,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -988,10 +1761,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -999,6 +1772,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -1012,10 +1794,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1023,10 +1805,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1042,31 +1855,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1074,6 +1879,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1088,18 +1906,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1107,6 +1925,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1121,18 +1954,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1140,6 +1973,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1154,18 +2028,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1173,11 +2047,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1189,85 +2083,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1275,13 +2186,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1291,85 +2269,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1377,13 +2364,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1394,42 +2424,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1437,6 +2451,18 @@ }, { "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], "type": "object", "required": [ "access_rule", @@ -1450,10 +2476,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1461,6 +2487,18 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], "type": "object", "required": [ "access_rule", @@ -1474,10 +2512,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1485,6 +2523,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1499,49 +2553,107 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } - } - ] - }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", - "oneOf": [ + }, { - "description": "A boolean value which can either be true or false", + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ - "type", - "value" + "instruction", + "withdraw_rule" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Bool" + "CREATE_ACCOUNT" ] }, - "value": { - "type": "boolean" + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] } } - }, + } + ] + }, + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1562,6 +2674,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1582,6 +2700,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1602,6 +2726,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1622,6 +2752,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1642,6 +2778,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1662,6 +2804,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1682,6 +2830,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1702,6 +2856,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1722,6 +2882,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1742,6 +2908,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1761,6 +2933,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1774,7 +2988,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1788,13 +3002,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1808,12 +3031,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1828,7 +3056,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1842,12 +3079,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1861,12 +3107,32 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -1884,7 +3150,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -1892,13 +3158,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -1917,7 +3212,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -1925,7 +3220,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -1936,10 +3231,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -1950,6 +3245,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -1965,13 +3280,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1992,6 +3313,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2011,26 +3338,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ "address", @@ -2040,7 +3362,7 @@ "type": { "type": "string", "enum": [ - "ComponentAddress" + "Address" ] }, "address": { @@ -2049,45 +3371,107 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "ResourceAddress" + "Bucket" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "Proof" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2097,225 +3481,157 @@ "type": { "type": "string", "enum": [ - "Hash" + "NonFungibleLocalId" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], "type": "object", "required": [ - "public_key", + "non_fungible_local_id", + "resource_address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1PublicKey" + "NonFungibleGlobalId" ] }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ - "signature", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1Signature" + "Expression" ] }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" + "value": { + "$ref": "#/definitions/Expression" } } }, { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ - "public_key", + "hash", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519PublicKey" + "Blob" ] }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "hash": { + "$ref": "#/definitions/Blob" } } }, { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" } - } - }, - { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" - } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", "type": "object", "required": [ "type", @@ -2337,6 +3653,16 @@ }, "EnumDiscriminator": { "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" + }, + { + "discriminator": "1", + "type": "U8" + } + ], "oneOf": [ { "type": "object", @@ -2379,159 +3705,619 @@ } ] }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "ManifestAstValueKind": { "oneOf": [ { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "Bool", + "value": true } - } + ], + "type": "string", + "enum": [ + "Bool" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } } - } + ], + "type": "string", + "enum": [ + "Enum" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], + "type": "string", + "enum": [ + "None" + ] + }, + { + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" }, - "value": { - "type": "string" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" } - } + ], + "type": "string", + "enum": [ + "Proof" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "value": { - "type": "string" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], + "type": "string", + "enum": [ + "Expression" + ] + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2542,6 +4328,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2561,6 +4353,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2584,6 +4382,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2595,6 +4403,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2615,6 +4429,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2635,6 +4455,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2657,6 +4483,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", diff --git a/schema/out/schema/analyze_manifest_response.json b/schema/out/schema/analyze_manifest_response.json index e4f19835..f2935de5 100644 --- a/schema/out/schema/analyze_manifest_response.json +++ b/schema/out/schema/analyze_manifest_response.json @@ -17,7 +17,7 @@ "description": "A set of all of the package addresses seen in the manifest. The underlying type of this is an array of `PackageAddress`es from the `Value` model.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" }, "uniqueItems": true }, @@ -25,7 +25,7 @@ "description": "A set of all of the component addresses seen in the manifest. The underlying type of this is an array of `ComponentAddress`es from the `Value` model.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" }, "uniqueItems": true }, @@ -33,7 +33,7 @@ "description": "A set of all of the resource addresses seen in the manifest. The underlying type of this is an array of `ResourceAddress`es from the `Value` model.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" }, "uniqueItems": true }, @@ -41,7 +41,7 @@ "description": "A set of all of the account component addresses seen in the manifest. The underlying type of this is an array of `ComponentAddress`es from the `Value` model.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" }, "uniqueItems": true }, @@ -49,7 +49,7 @@ "description": "A set of all of the account component addresses in the manifest which had methods invoked on them that would typically require auth (or a signature) to be called successfully. This is a subset of the addresses seen in `account_addresses`. The underlying type of this is an array of `ComponentAddress`es from the `Value` model.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" }, "uniqueItems": true }, @@ -57,7 +57,7 @@ "description": "A set of all of the account component addresses in the manifest which were withdrawn from. This is a subset of the addresses seen in `account_addresses`. The underlying type of this is an array of `ComponentAddress`es from the `Value` model.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" }, "uniqueItems": true }, @@ -65,1186 +65,91 @@ "description": "A set of all of the account component addresses in the manifest which were deposited into. This is a subset of the addresses seen in `account_addresses`. The underlying type of this is an array of `ComponentAddress`es from the `Value` model.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" }, "uniqueItems": true } }, "definitions": { - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "EntityAddress": { + "description": "A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded string.", "oneOf": [ { - "description": "A boolean value which can either be true or false", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bool" - ] - }, - "value": { - "type": "boolean" - } - } - }, - { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A type representing a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", - "type": "object", - "required": [ - "type", - "variant" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Enum" - ] - }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Array" - ] - }, - "element_kind": { - "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", - "type": "object", - "required": [ - "entries", - "key_value_kind", - "type", - "value_value_kind" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Map" - ] - }, - "key_value_kind": { - "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "value_value_kind": { - "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "entries": { - "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/Value" - }, - { - "$ref": "#/definitions/Value" - } - ], - "maxItems": 2, - "minItems": 2 - } - } - } - }, - { - "description": "An array of elements where elements could be of different kinds.", - "type": "object", - "required": [ - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Tuple" - ] - }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Decimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PreciseDecimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] - }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PackageAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "ComponentAddress" } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_local_id", - "resource_address", + "address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" + "ComponentAddress" ] }, - "value": { - "$ref": "#/definitions/Expression" + "address": { + "type": "string" } } }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "ResourceAddress" } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" - } - } - } - ] - }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ - { "type": "object", "required": [ - "discriminator", + "address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "ResourceAddress" ] }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", + "address": { "type": "string" } } }, { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "PackageAddress" } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ] - }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "TransientIdentifier": { - "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", - "oneOf": [ - { "type": "object", "required": [ - "type", - "value" + "address", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "PackageAddress" ] }, - "value": { - "description": "A string identifier", + "address": { "type": "string" } } - }, - { - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "NonFungibleLocalId": { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Integer" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "UUID" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "maxLength": 128, - "minLength": 2, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id. This can be between 1 and 64 characters long.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 1 - } - } } ] - }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" - ] - }, - "Blob": { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" } } } \ No newline at end of file diff --git a/schema/out/schema/analyze_manifest_with_preview_context_request.json b/schema/out/schema/analyze_manifest_with_preview_context_request.json new file mode 100644 index 00000000..c40d03e7 --- /dev/null +++ b/schema/out/schema/analyze_manifest_with_preview_context_request.json @@ -0,0 +1,4535 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AnalyzeManifestWithPreviewContextRequest", + "description": "Analyzes the passed manifest to determine the entities that this manifest interacts with.", + "type": "object", + "required": [ + "manifest", + "network_id", + "transaction_receipt" + ], + "properties": { + "network_id": { + "description": "An unsigned 8 bit integer serialized as a string which represents the ID of the network that the manifest will be used on. The primary use of this is for any Bech32m encoding or decoding of addresses", + "type": "string", + "pattern": "[0-9]+" + }, + "manifest": { + "description": "The manifest to analyze.", + "allOf": [ + { + "$ref": "#/definitions/TransactionManifest" + } + ] + }, + "transaction_receipt": { + "description": "The SBOR encoded transaction receipt obtained from the performing a transaction preview with the given manifest. This byte array is serialized as a hex-encoded byte array.", + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + }, + "definitions": { + "TransactionManifest": { + "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], + "type": "object", + "required": [ + "blobs", + "instructions" + ], + "properties": { + "instructions": { + "description": "The transaction manifest instructions to be executed in the transaction.", + "allOf": [ + { + "$ref": "#/definitions/InstructionList" + } + ] + }, + "blobs": { + "description": "An array of byte arrays which is serialized as an array of hex strings which represents the blobs included in the transaction.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "InstructionList": { + "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", + "oneOf": [ + { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Parsed" + ] + }, + "value": { + "type": "array", + "items": { + "$ref": "#/definitions/Instruction" + } + } + } + } + ] + }, + "Instruction": { + "description": "The Instruction model defines the structure that transaction manifest instructions follow during communication with the Radix Engine Toolkit", + "oneOf": [ + { + "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "blueprint_name", + "function_name", + "instruction", + "package_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CALL_FUNCTION" + ] + }, + "package_address": { + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "blueprint_name": { + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "function_name": { + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "arguments": { + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/ManifestAstValue" + } + } + } + }, + { + "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], + "type": "object", + "required": [ + "component_address", + "instruction", + "method_name" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CALL_METHOD" + ] + }, + "component_address": { + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "method_name": { + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "arguments": { + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/ManifestAstValue" + } + } + } + }, + { + "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "instruction", + "into_bucket", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "TAKE_FROM_WORKTOP" + ] + }, + "resource_address": { + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "amount", + "instruction", + "into_bucket", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "TAKE_FROM_WORKTOP_BY_AMOUNT" + ] + }, + "resource_address": { + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "amount": { + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "ids", + "instruction", + "into_bucket", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "TAKE_FROM_WORKTOP_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "ids": { + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleLocalId" + }, + "uniqueItems": true + }, + "into_bucket": { + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "RETURN_TO_WORKTOP" + ] + }, + "bucket": { + "description": "The bucket to return to the worktop.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "instruction", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "ASSERT_WORKTOP_CONTAINS" + ] + }, + "resource_address": { + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "amount", + "instruction", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT" + ] + }, + "resource_address": { + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "amount": { + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "ids", + "instruction", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "ASSERT_WORKTOP_CONTAINS_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "ids": { + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleLocalId" + }, + "uniqueItems": true + } + } + }, + { + "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], + "type": "object", + "required": [ + "instruction", + "into_proof" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "POP_FROM_AUTH_ZONE" + ] + }, + "into_proof": { + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], + "type": "object", + "required": [ + "instruction", + "proof" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUSH_TO_AUTH_ZONE" + ] + }, + "proof": { + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_AUTH_ZONE" + ] + } + } + }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, + { + "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "amount", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "amount": { + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "ids": { + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleLocalId" + }, + "uniqueItems": true + }, + "into_proof": { + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], + "type": "object", + "required": [ + "bucket", + "instruction", + "into_proof" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_BUCKET" + ] + }, + "bucket": { + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], + "type": "object", + "required": [ + "instruction", + "into_proof", + "proof" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLONE_PROOF" + ] + }, + "proof": { + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "into_proof": { + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], + "type": "object", + "required": [ + "instruction", + "proof" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "DROP_PROOF" + ] + }, + "proof": { + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "DROP_ALL_PROOFS" + ] + } + } + }, + { + "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } + } + ], + "type": "object", + "required": [ + "access_rules", + "code", + "instruction", + "metadata", + "royalty_config", + "schema" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "PUBLISH_PACKAGE" + ] + }, + "code": { + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], + "type": "object", + "required": [ + "bucket", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "BURN_RESOURCE" + ] + }, + "bucket": { + "description": "The bucket of tokens to burn.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], + "type": "object", + "required": [ + "amount", + "instruction", + "vault_id" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "RECALL_RESOURCE" + ] + }, + "vault_id": { + "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "amount": { + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key", + "value" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "SET_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "value": { + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], + "type": "object", + "required": [ + "instruction", + "package_address", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "SET_PACKAGE_ROYALTY_CONFIG" + ] + }, + "package_address": { + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], + "type": "object", + "required": [ + "component_address", + "instruction", + "royalty_config" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "SET_COMPONENT_ROYALTY_CONFIG" + ] + }, + "component_address": { + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "royalty_config": { + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "instruction", + "package_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLAIM_PACKAGE_ROYALTY" + ] + }, + "package_address": { + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], + "type": "object", + "required": [ + "component_address", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLAIM_COMPONENT_ROYALTY" + ] + }, + "component_address": { + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key", + "rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "SET_METHOD_ACCESS_RULE" + ] + }, + "entity_address": { + "description": "The entity address of the entity to modify the access rules for.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "rule": { + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "amount", + "instruction", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "MINT_FUNGIBLE" + ] + }, + "resource_address": { + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "amount": { + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "entries", + "instruction", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "MINT_NON_FUNGIBLE" + ] + }, + "resource_address": { + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "entries", + "instruction", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "MINT_UUID_NON_FUNGIBLE" + ] + }, + "resource_address": { + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "entries": { + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], + "type": "object", + "required": [ + "access_rules", + "divisibility", + "instruction", + "metadata" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], + "type": "object", + "required": [ + "access_rules", + "divisibility", + "initial_supply", + "instruction", + "metadata" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" + ] + }, + "divisibility": { + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "initial_supply": { + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], + "type": "object", + "required": [ + "access_rules", + "id_type", + "instruction", + "metadata", + "schema" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to create a non-fungible resource with an initial supply", + "type": "object", + "required": [ + "access_rules", + "id_type", + "initial_supply", + "instruction", + "metadata", + "schema" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" + ] + }, + "id_type": { + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "initial_supply": { + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], + "type": "object", + "required": [ + "controlled_asset", + "instruction", + "rule_set", + "timed_recovery_delay_in_minutes" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCESS_CONTROLLER" + ] + }, + "controlled_asset": { + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "timed_recovery_delay_in_minutes": { + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], + "type": "object", + "required": [ + "access_rule", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_IDENTITY" + ] + }, + "access_rule": { + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], + "type": "object", + "required": [ + "access_rule", + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "ASSERT_ACCESS_RULE" + ] + }, + "access_rule": { + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "key", + "owner_access_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_VALIDATOR" + ] + }, + "key": { + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "owner_access_rule": { + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "withdraw_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCOUNT" + ] + }, + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + } + ] + }, + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", + "allOf": [ + { + "$ref": "#/definitions/EnumDiscriminator" + } + ] + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/ManifestAstValue" + } + } + } + }, + { + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Some" + ] + }, + "value": { + "$ref": "#/definitions/ManifestAstValue" + } + } + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "None" + ] + } + } + }, + { + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ok" + ] + }, + "value": { + "$ref": "#/definitions/ManifestAstValue" + } + } + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Err" + ] + }, + "value": { + "$ref": "#/definitions/ManifestAstValue" + } + } + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/ManifestAstValue" + } + } + } + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/ManifestAstValue" + }, + { + "$ref": "#/definitions/ManifestAstValue" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/ManifestAstValue" + } + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + ], + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Address" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "identifier": { + "$ref": "#/definitions/BucketId" + } + } + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "$ref": "#/definitions/ProofId" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + "value": { + "$ref": "#/definitions/NonFungibleLocalId" + } + } + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], + "type": "object", + "required": [ + "non_fungible_local_id", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string" + } + } + } + ] + }, + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" + }, + { + "discriminator": "1", + "type": "U8" + } + ], + "oneOf": [ + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "discriminator", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } + } + ] + }, + "ManifestAstValueKind": { + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "string", + "enum": [ + "Bool" + ] + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], + "type": "string", + "enum": [ + "Enum" + ] + }, + { + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], + "type": "string", + "enum": [ + "None" + ] + }, + { + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + ], + "type": "string", + "enum": [ + "Address" + ] + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], + "type": "string", + "enum": [ + "Proof" + ] + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], + "type": "string", + "enum": [ + "Expression" + ] + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], + "type": "string", + "enum": [ + "Bytes" + ] + } + ] + }, + "BucketId": { + "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "TransientIdentifier": { + "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", + "oneOf": [ + { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "description": "A string identifier", + "type": "string" + } + } + }, + { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "type": "string", + "pattern": "[0-9]+" + } + } + } + ] + }, + "ProofId": { + "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], + "allOf": [ + { + "$ref": "#/definitions/TransientIdentifier" + } + ] + }, + "NonFungibleLocalId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Integer" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "UUID" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "maxLength": 128, + "minLength": 2, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 1 + } + } + } + ] + }, + "Expression": { + "description": "Represents a transaction manifest expression.", + "type": "string", + "enum": [ + "ENTIRE_WORKTOP", + "ENTIRE_AUTH_ZONE" + ] + }, + "Blob": { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "type": "string", + "maxLength": 64, + "minLength": 64, + "pattern": "[0-9a-fA-F]+" + } + } +} \ No newline at end of file diff --git a/schema/out/schema/analyze_manifest_with_preview_context_response.json b/schema/out/schema/analyze_manifest_with_preview_context_response.json new file mode 100644 index 00000000..0320505a --- /dev/null +++ b/schema/out/schema/analyze_manifest_with_preview_context_response.json @@ -0,0 +1,553 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "AnalyzeManifestWithPreviewContextResponse", + "description": "The response of the [`AnalyzeManifestWithPreviewContextRequest`]", + "type": "object", + "required": [ + "account_deposits", + "account_proof_resources", + "account_withdraws", + "accounts_requiring_auth", + "created_entities", + "encountered_addresses" + ], + "properties": { + "encountered_addresses": { + "description": "The set of addresses encountered in the manifest.\n\nThis field is populated through static analysis of the manifest and captures the set of all addresses encountered in the manifest. This captures addresses if they're used in calls, used as arguments, or contained as parts of some list or array.", + "allOf": [ + { + "$ref": "#/definitions/EncounteredAddresses" + } + ] + }, + "accounts_requiring_auth": { + "description": "A set of account component addresses which were involved in actions that require auth.\n\nThis field is obtained through static analysis of the manifest by the Radix Engine Toolkit. When the toolkit encounters an instruction being performed on an account that requires auth (e.g., withdrawing funds, locking fee, creating proofs), it is added to this address set.\n\nIt is then the job of the wallet to determine whether the account has been securified and uses an access controller or is still operating in signature mode and produce the correct auth based on that.", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "account_proof_resources": { + "description": "A set of the resource addresses of which proofs were created from accounts in this manifest.\n\nThis field is populated through static analysis of the manifest instruction. This field captures the resource addresses of all of the proofs created from accounts throughout the manifest. This field does not capture the amount of the proof created nor which account the proof was created from.", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "account_withdraws": { + "description": "A list of the account withdraws seen in the manifest.\n\nThis field is populated through static analysis of the manifest and it captures information relating to the resources withdrawn from accounts such as the component address of the account, the resource address of the withdrawn, and either an amount or set of non-fungible local ids of the withdrawn resources.", + "type": "array", + "items": { + "$ref": "#/definitions/AccountWithdraw" + } + }, + "account_deposits": { + "description": "A list of the account deposits which occur in the transaction.\n\nThis field is populated through both static analysis of the manifest and through the context provided by the transaction preview. All deposits referred to as \"exact\" are deposits which are guaranteed by the static analysis while the ones referred to as \"estimate\" are deposits which are primarily obtained from the context of the previews", + "type": "array", + "items": { + "$ref": "#/definitions/AccountDeposit" + } + }, + "created_entities": { + "description": "The set of entities which were newly created in this transaction.", + "allOf": [ + { + "$ref": "#/definitions/CreatedEntities" + } + ] + } + }, + "definitions": { + "EncounteredAddresses": { + "description": "The set of addresses encountered in the manifest", + "type": "object", + "required": [ + "component_addresses", + "package_addresses", + "resource_addresses" + ], + "properties": { + "component_addresses": { + "description": "The set of component addresses encountered in the manifest", + "allOf": [ + { + "$ref": "#/definitions/EncounteredComponents" + } + ] + }, + "resource_addresses": { + "description": "The set of resource addresses encountered in the manifest", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "package_addresses": { + "description": "The set of package addresses encountered in the manifest", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + } + } + }, + "EncounteredComponents": { + "description": "The set of addresses encountered in the manifest", + "type": "object", + "required": [ + "access_controller", + "accounts", + "clocks", + "epoch_managers", + "identities", + "user_applications", + "validators" + ], + "properties": { + "user_applications": { + "description": "The set of user application components encountered in the manifest", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "accounts": { + "description": "The set of account components encountered in the manifest", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "identities": { + "description": "The set of identity components encountered in the manifest", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "clocks": { + "description": "The set of clock components encountered in the manifest", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "epoch_managers": { + "description": "The set of epoch_manager components encountered in the manifest", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "validators": { + "description": "The set of validator components encountered in the manifest", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "access_controller": { + "description": "The set of validator components encountered in the manifest", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + } + } + }, + "EntityAddress": { + "description": "A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded string.", + "oneOf": [ + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "ComponentAddress" + } + ], + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "ResourceAddress" + } + ], + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "PackageAddress" + } + ], + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + } + ] + }, + "AccountWithdraw": { + "type": "object", + "required": [ + "component_address", + "resource_specifier" + ], + "properties": { + "component_address": { + "description": "The component address of the account that the resources were withdrawn from.", + "allOf": [ + { + "$ref": "#/definitions/EntityAddress" + } + ] + }, + "resource_specifier": { + "description": "A specifier used to specify what was withdrawn from the account - this could either be an amount or a set of non-fungible local ids.\n\nWhen this vector has more than one item, it means that multiple instructions performed a withdraw from the same account of the same resource.", + "allOf": [ + { + "$ref": "#/definitions/ResourceSpecifier" + } + ] + } + } + }, + "ResourceSpecifier": { + "description": "Specifies resources either through amounts for fungible and non-fungible resources or through ids for non-fungible resources.", + "oneOf": [ + { + "type": "object", + "required": [ + "amount", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Amount" + ] + }, + "resource_address": { + "description": "The resource address associated with the resource", + "allOf": [ + { + "$ref": "#/definitions/EntityAddress" + } + ] + }, + "amount": { + "description": "The amount of resources withdrawn from the account. This is a decimal value which is serialized as a string.", + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "type": "object", + "required": [ + "ids", + "resource_address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Ids" + ] + }, + "resource_address": { + "description": "The resource address associated with the resource", + "allOf": [ + { + "$ref": "#/definitions/EntityAddress" + } + ] + }, + "ids": { + "description": "The set of non-fungible ids", + "type": "array", + "items": { + "$ref": "#/definitions/NonFungibleLocalId" + }, + "uniqueItems": true + } + } + } + ] + }, + "NonFungibleLocalId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ + { + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Integer" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "UUID" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bytes" + ] + }, + "value": { + "type": "string", + "maxLength": 128, + "minLength": 2, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string", + "maxLength": 64, + "minLength": 1 + } + } + } + ] + }, + "AccountDeposit": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "resource_specifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Exact" + ] + }, + "resource_specifier": { + "description": "A specifier of the amount or ids of resources.", + "allOf": [ + { + "$ref": "#/definitions/ResourceSpecifier" + } + ] + } + } + }, + { + "type": "object", + "required": [ + "instruction_index", + "resource_specifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Estimate" + ] + }, + "instruction_index": { + "description": "The instruction index that that this amount originates from. This might either be an instruction where a bucket is created of all worktop resources or an instruction where a deposit is performed of an estimated amount.", + "type": "string", + "pattern": "[0-9]+" + }, + "resource_specifier": { + "description": "A specifier of the amount or ids of resources.", + "allOf": [ + { + "$ref": "#/definitions/ResourceSpecifier" + } + ] + } + } + } + ], + "required": [ + "component_address" + ], + "properties": { + "component_address": { + "$ref": "#/definitions/EntityAddress" + } + } + }, + "CreatedEntities": { + "description": "The set of newly created entities", + "type": "object", + "required": [ + "component_addresses", + "package_addresses", + "resource_addresses" + ], + "properties": { + "component_addresses": { + "description": "The set of addresses of newly created components.", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "resource_addresses": { + "description": "The set of addresses of newly created resources.", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + }, + "package_addresses": { + "description": "The set of addresses of newly created packages.", + "type": "array", + "items": { + "$ref": "#/definitions/EntityAddress" + }, + "uniqueItems": true + } + } + } + } +} \ No newline at end of file diff --git a/schema/out/schema/compile_notarized_transaction_request.json b/schema/out/schema/compile_notarized_transaction_request.json index 2266174b..5dd0aa52 100644 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ b/schema/out/schema/compile_notarized_transaction_request.json @@ -2,6 +2,81 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "CompileNotarizedTransactionRequest", "description": "This function does the opposite of the compile_signed_transaction_intent function. This function takes in a compiled signed transaction intent and decompiles it into its transaction intent and signatures.", + "examples": [ + { + "notary_signature": { + "curve": "EcdsaSecp256k1", + "signature": "017c36e8850679465e3beb4d8d945ec1875adb715cf62c2112025064b0a77a6ca818444970c69eafd2ed2ee1f50443498064aa477773a6dda5f49bfb84e2c4b834" + }, + "signed_intent": { + "intent": { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "008db363f3dfda37dfc9e7d45eb72c2405939124b3b962df506fa9cca0017be0092e1341b79694228c4f53c80e790ef9258aafbf5051769a126ddf588016ad282f" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0174adbe3362c446ea2368ee1986864edc18f3eefc8b9ea0162756f04ffed310450a327cb3f8873070fc607844acec45b46490b4892fc4110c920ae28251b79100" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "01f55560f0fd9c1a90fca4a01c0e6cb613840ecd0a07fec7401e5e51b93f44df15586ec4a3d33a1811a6238e397e9964a1126ff32378dc5626c5126499ba3aac44" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "003fbca8a171f60a9a30a93fce9e846f130fee2a5989b7a93212877bf38f0afbb82ba7c9b718882bbf99a97f74fca1fe86ab4e6d85238873b29e851c193a48222e" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "0903d71eb96aa704338365d3ae15c0e8ca08d29aa1828a0439ecd0f0b64ba3fbee4f44c0bd694d08be51ebbb7d07c61961875894938b827627e5a77367b7320d" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "fce6e33719e6bf51f0ebe35cfe1ba26ce167063da7c7eaf48ecde64e3eb21bfcc2752c793c36a04493f52798bfcaaca66af70d889655067b1b5f3014f6cc7b0b" + }, + { + "curve": "EddsaEd25519", + "public_key": "fd50b8e3b144ea244fbf7737f550bc8dd0c2650bbc1aada833ca17ff8dbf329b", + "signature": "0a57400709fa697cc26268e959f29b1bc1d5fb6ed9b6a75381ca610cb9208f3a51ea72eced28e8e0636693a27e5019435827624e599aad30bfca4abbdae58b09" + }, + { + "curve": "EddsaEd25519", + "public_key": "fde4fba030ad002f7c2f7d4c331f49d13fb0ec747eceebec634f1ff4cbca9def", + "signature": "b3e149d3ce05f5e0e692e449095c8c0afbf0e51bd226ce087dd6f927c351240481440518695ed9521af29abac1e4fd59bf58ed251c0522dd55eda773d2b83504" + } + ] + } + } + ], "type": "object", "required": [ "notary_signature", @@ -28,6 +103,75 @@ "definitions": { "SignedTransactionIntent": { "description": "A signed transaction intent which is made up of the intent as well as the intent signatures.", + "examples": [ + { + "intent": { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "008db363f3dfda37dfc9e7d45eb72c2405939124b3b962df506fa9cca0017be0092e1341b79694228c4f53c80e790ef9258aafbf5051769a126ddf588016ad282f" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0174adbe3362c446ea2368ee1986864edc18f3eefc8b9ea0162756f04ffed310450a327cb3f8873070fc607844acec45b46490b4892fc4110c920ae28251b79100" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "01f55560f0fd9c1a90fca4a01c0e6cb613840ecd0a07fec7401e5e51b93f44df15586ec4a3d33a1811a6238e397e9964a1126ff32378dc5626c5126499ba3aac44" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "003fbca8a171f60a9a30a93fce9e846f130fee2a5989b7a93212877bf38f0afbb82ba7c9b718882bbf99a97f74fca1fe86ab4e6d85238873b29e851c193a48222e" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "0903d71eb96aa704338365d3ae15c0e8ca08d29aa1828a0439ecd0f0b64ba3fbee4f44c0bd694d08be51ebbb7d07c61961875894938b827627e5a77367b7320d" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "fce6e33719e6bf51f0ebe35cfe1ba26ce167063da7c7eaf48ecde64e3eb21bfcc2752c793c36a04493f52798bfcaaca66af70d889655067b1b5f3014f6cc7b0b" + }, + { + "curve": "EddsaEd25519", + "public_key": "fd50b8e3b144ea244fbf7737f550bc8dd0c2650bbc1aada833ca17ff8dbf329b", + "signature": "0a57400709fa697cc26268e959f29b1bc1d5fb6ed9b6a75381ca610cb9208f3a51ea72eced28e8e0636693a27e5019435827624e599aad30bfca4abbdae58b09" + }, + { + "curve": "EddsaEd25519", + "public_key": "fde4fba030ad002f7c2f7d4c331f49d13fb0ec747eceebec634f1ff4cbca9def", + "signature": "b3e149d3ce05f5e0e692e449095c8c0afbf0e51bd226ce087dd6f927c351240481440518695ed9521af29abac1e4fd59bf58ed251c0522dd55eda773d2b83504" + } + ] + } + ], "type": "object", "required": [ "intent", @@ -53,6 +197,31 @@ }, "TransactionIntent": { "description": "A transaction intent which is made of the header containing the transaction metadata and a manifest consisting of the instructions and blobs.", + "examples": [ + { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + } + ], "type": "object", "required": [ "header", @@ -79,6 +248,36 @@ }, "TransactionHeader": { "description": "A transaction header containing metadata and other transaction information.", + "examples": [ + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + } + ], "type": "object", "required": [ "cost_unit_limit", @@ -139,6 +338,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -161,6 +366,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", @@ -185,6 +396,15 @@ }, "TransactionManifest": { "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -212,6 +432,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -230,6 +456,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -257,6 +493,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -272,43 +594,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -323,35 +705,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -366,18 +778,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -385,6 +797,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -400,26 +850,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -427,6 +877,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -442,15 +940,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -458,10 +956,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -469,6 +967,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -485,7 +995,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -493,6 +1003,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -506,10 +1032,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -517,6 +1043,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -531,18 +1081,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -550,6 +1100,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -564,15 +1148,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -583,6 +1167,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -596,10 +1192,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -607,6 +1203,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -620,10 +1228,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -631,6 +1239,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -644,8 +1257,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -660,18 +1323,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -679,6 +1342,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -694,26 +1395,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -721,30 +1422,78 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", - "type": "object", - "required": [ - "ids", - "instruction", - "into_proof", - "resource_address" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" - ] - }, - "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", - "allOf": [ + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -752,10 +1501,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -763,6 +1512,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -777,18 +1545,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -796,6 +1564,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -810,18 +1597,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -829,6 +1616,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -842,10 +1641,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -853,6 +1652,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -868,14 +1672,82 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } + } + ], "type": "object", "required": [ - "abi", "access_rules", "code", "instruction", "metadata", - "royalty_config" + "royalty_config", + "schema" ], "properties": { "instruction": { @@ -885,84 +1757,42 @@ ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - } - } - }, - { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", - "type": "object", - "required": [ - "abi", - "code", - "instruction", - "owner_badge" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -970,6 +1800,18 @@ }, { "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ "bucket", @@ -986,7 +1828,7 @@ "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -994,6 +1836,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -1011,15 +1866,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1027,6 +1882,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -1045,23 +1935,69 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1069,6 +2005,21 @@ }, { "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], "type": "object", "required": [ "instruction", @@ -1083,18 +2034,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1102,6 +2053,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -1116,18 +2091,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1135,6 +2110,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -1148,10 +2132,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1159,6 +2143,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -1172,10 +2165,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1183,10 +2176,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1202,31 +2226,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1234,6 +2250,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1248,18 +2277,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1267,6 +2296,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1281,18 +2325,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1300,6 +2344,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1314,18 +2399,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1333,11 +2418,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1349,85 +2454,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1435,13 +2557,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1451,85 +2640,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1537,13 +2735,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1554,42 +2795,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1597,6 +2822,18 @@ }, { "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], "type": "object", "required": [ "access_rule", @@ -1610,10 +2847,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1621,6 +2858,18 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], "type": "object", "required": [ "access_rule", @@ -1634,10 +2883,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1645,6 +2894,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1659,18 +2924,54 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "withdraw_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCOUNT" + ] + }, + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1678,11 +2979,27 @@ } ] }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], "oneOf": [ { "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -1702,6 +3019,12 @@ }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1722,6 +3045,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1742,6 +3071,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1762,6 +3097,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1782,6 +3123,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1802,6 +3149,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1822,6 +3175,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1842,6 +3201,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1862,6 +3227,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1882,6 +3253,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1902,6 +3279,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1921,6 +3304,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1934,7 +3359,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1948,13 +3373,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1968,12 +3402,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1988,7 +3427,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -2002,12 +3450,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -2021,12 +3478,32 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -2044,7 +3521,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2052,13 +3529,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -2077,7 +3583,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2085,7 +3591,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2096,10 +3602,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -2110,6 +3616,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -2125,13 +3651,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2152,6 +3684,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2171,26 +3709,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ "address", @@ -2200,7 +3733,7 @@ "type": { "type": "string", "enum": [ - "ComponentAddress" + "Address" ] }, "address": { @@ -2209,45 +3742,107 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "ResourceAddress" + "Bucket" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "Proof" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2257,441 +3852,843 @@ "type": { "type": "string", "enum": [ - "Hash" + "NonFungibleLocalId" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + ], "type": "object", "required": [ - "signature", + "non_fungible_local_id", + "resource_address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1Signature" + "NonFungibleGlobalId" ] }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ - "public_key", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519PublicKey" + "Expression" ] }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "value": { + "$ref": "#/definitions/Expression" } } }, { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ - "signature", + "hash", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519Signature" + "Blob" ] }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" + "hash": { + "$ref": "#/definitions/Blob" } } }, { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], "type": "object", "required": [ - "identifier", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "Bucket" + "Bytes" ] }, - "identifier": { - "$ref": "#/definitions/BucketId" + "value": { + "type": "string" } } + } + ] + }, + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" }, { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "discriminator": "1", + "type": "U8" + } + ], + "oneOf": [ + { "type": "object", "required": [ - "identifier", + "discriminator", "type" ], "properties": { "type": { "type": "string", "enum": [ - "Proof" + "String" ] }, - "identifier": { - "$ref": "#/definitions/ProofId" + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" } } }, { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "required": [ - "type", - "value" + "discriminator", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "NonFungibleLocalId" + "U8" ] }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" } } + } + ] + }, + "ManifestAstValueKind": { + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "string", + "enum": [ + "Bool" + ] }, { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } }, - "resource_address": { - "$ref": "#/definitions/Value" + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } } - } + ], + "type": "string", + "enum": [ + "Enum" + ] }, { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" } - } + ], + "type": "string", + "enum": [ + "None" + ] }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } } - } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] }, { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" } - } - } - ] - }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, { - "type": "object", - "required": [ - "discriminator", - "type" + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" } - } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" } - } + ], + "type": "string", + "enum": [ + "Proof" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } } - } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" }, - "value": { - "type": "string" + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" } - } + ], + "type": "string", + "enum": [ + "Expression" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" } - } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2702,6 +4699,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2721,6 +4724,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2744,6 +4753,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2755,6 +4774,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2775,6 +4800,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2795,6 +4826,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2817,6 +4854,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2858,6 +4901,12 @@ "oneOf": [ { "description": "Cryptographic signature and public key for Ecdsa Secp256k1", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" + } + ], "type": "object", "required": [ "curve", @@ -2881,6 +4930,13 @@ }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" + } + ], "type": "object", "required": [ "curve", @@ -2917,6 +4973,12 @@ "oneOf": [ { "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" + } + ], "type": "object", "required": [ "curve", @@ -2939,6 +5001,12 @@ }, { "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" + } + ], "type": "object", "required": [ "curve", diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json index f41d7032..2c2aab48 100644 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ b/schema/out/schema/compile_signed_transaction_intent_request.json @@ -2,6 +2,75 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "CompileSignedTransactionIntentRequest", "description": "Takes in a raw transaction intent as well as its signatures and compiles it. This is useful when a notary wishes to notarize a signed transaction intent.", + "examples": [ + { + "intent": { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "008db363f3dfda37dfc9e7d45eb72c2405939124b3b962df506fa9cca0017be0092e1341b79694228c4f53c80e790ef9258aafbf5051769a126ddf588016ad282f" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0174adbe3362c446ea2368ee1986864edc18f3eefc8b9ea0162756f04ffed310450a327cb3f8873070fc607844acec45b46490b4892fc4110c920ae28251b79100" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "01f55560f0fd9c1a90fca4a01c0e6cb613840ecd0a07fec7401e5e51b93f44df15586ec4a3d33a1811a6238e397e9964a1126ff32378dc5626c5126499ba3aac44" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "003fbca8a171f60a9a30a93fce9e846f130fee2a5989b7a93212877bf38f0afbb82ba7c9b718882bbf99a97f74fca1fe86ab4e6d85238873b29e851c193a48222e" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "0903d71eb96aa704338365d3ae15c0e8ca08d29aa1828a0439ecd0f0b64ba3fbee4f44c0bd694d08be51ebbb7d07c61961875894938b827627e5a77367b7320d" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "fce6e33719e6bf51f0ebe35cfe1ba26ce167063da7c7eaf48ecde64e3eb21bfcc2752c793c36a04493f52798bfcaaca66af70d889655067b1b5f3014f6cc7b0b" + }, + { + "curve": "EddsaEd25519", + "public_key": "fd50b8e3b144ea244fbf7737f550bc8dd0c2650bbc1aada833ca17ff8dbf329b", + "signature": "0a57400709fa697cc26268e959f29b1bc1d5fb6ed9b6a75381ca610cb9208f3a51ea72eced28e8e0636693a27e5019435827624e599aad30bfca4abbdae58b09" + }, + { + "curve": "EddsaEd25519", + "public_key": "fde4fba030ad002f7c2f7d4c331f49d13fb0ec747eceebec634f1ff4cbca9def", + "signature": "b3e149d3ce05f5e0e692e449095c8c0afbf0e51bd226ce087dd6f927c351240481440518695ed9521af29abac1e4fd59bf58ed251c0522dd55eda773d2b83504" + } + ] + } + ], "type": "object", "required": [ "intent", @@ -27,6 +96,31 @@ "definitions": { "TransactionIntent": { "description": "A transaction intent which is made of the header containing the transaction metadata and a manifest consisting of the instructions and blobs.", + "examples": [ + { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + } + ], "type": "object", "required": [ "header", @@ -53,6 +147,36 @@ }, "TransactionHeader": { "description": "A transaction header containing metadata and other transaction information.", + "examples": [ + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + } + ], "type": "object", "required": [ "cost_unit_limit", @@ -113,6 +237,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -135,6 +265,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", @@ -159,6 +295,15 @@ }, "TransactionManifest": { "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -186,6 +331,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -204,6 +355,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -231,6 +392,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -246,43 +493,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -297,35 +604,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -340,18 +677,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -359,6 +696,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -374,26 +749,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -401,6 +776,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -416,15 +839,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -432,10 +855,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -443,6 +866,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -459,7 +894,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -467,6 +902,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -480,10 +931,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -491,6 +942,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -505,18 +980,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -524,6 +999,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -538,15 +1047,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -557,6 +1066,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -570,10 +1091,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -581,6 +1102,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -594,10 +1127,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -605,6 +1138,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -618,8 +1156,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -634,18 +1222,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -653,6 +1241,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -668,26 +1294,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -695,6 +1321,54 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -710,15 +1384,15 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -726,10 +1400,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -737,6 +1411,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -751,18 +1444,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -770,6 +1463,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -784,18 +1496,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -803,6 +1515,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -816,10 +1540,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -827,6 +1551,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -842,14 +1571,82 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } + } + ], "type": "object", "required": [ - "abi", "access_rules", "code", "instruction", "metadata", - "royalty_config" + "royalty_config", + "schema" ], "properties": { "instruction": { @@ -859,84 +1656,42 @@ ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - } - } - }, - { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", - "type": "object", - "required": [ - "abi", - "code", - "instruction", - "owner_badge" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -944,6 +1699,18 @@ }, { "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ "bucket", @@ -960,7 +1727,7 @@ "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -968,6 +1735,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -985,15 +1765,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1001,6 +1781,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -1019,23 +1834,69 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1043,6 +1904,21 @@ }, { "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], "type": "object", "required": [ "instruction", @@ -1057,18 +1933,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1076,6 +1952,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -1090,18 +1990,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1109,6 +2009,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -1122,10 +2031,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1133,6 +2042,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -1146,10 +2064,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1157,10 +2075,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1176,31 +2125,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1208,6 +2149,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1222,18 +2176,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1241,6 +2195,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1255,18 +2224,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1274,6 +2243,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1288,18 +2298,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1307,11 +2317,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1323,85 +2353,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1409,13 +2456,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1425,85 +2539,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1511,13 +2634,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1528,42 +2694,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1571,6 +2721,18 @@ }, { "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], "type": "object", "required": [ "access_rule", @@ -1584,10 +2746,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1595,8 +2757,20 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", - "type": "object", - "required": [ + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], + "type": "object", + "required": [ "access_rule", "instruction" ], @@ -1608,10 +2782,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1619,6 +2793,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1633,18 +2823,54 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "withdraw_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCOUNT" + ] + }, + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1652,11 +2878,27 @@ } ] }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], "oneOf": [ { "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -1676,6 +2918,12 @@ }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1696,6 +2944,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1716,6 +2970,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1736,6 +2996,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1756,6 +3022,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1776,6 +3048,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1796,6 +3074,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1816,6 +3100,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1836,6 +3126,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1856,6 +3152,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1876,6 +3178,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1895,6 +3203,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1908,7 +3258,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1922,13 +3272,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1942,12 +3301,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1962,7 +3326,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1976,12 +3349,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1995,12 +3377,32 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -2018,7 +3420,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2026,13 +3428,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -2051,7 +3482,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2059,7 +3490,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2070,10 +3501,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -2084,6 +3515,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -2099,13 +3550,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2126,6 +3583,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2145,26 +3608,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ "address", @@ -2174,7 +3632,7 @@ "type": { "type": "string", "enum": [ - "ComponentAddress" + "Address" ] }, "address": { @@ -2183,45 +3641,107 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "ResourceAddress" + "Bucket" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "Proof" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2231,441 +3751,843 @@ "type": { "type": "string", "enum": [ - "Hash" + "NonFungibleLocalId" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], "type": "object", "required": [ - "public_key", + "non_fungible_local_id", + "resource_address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1PublicKey" + "NonFungibleGlobalId" ] }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ - "signature", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1Signature" + "Expression" ] }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" + "value": { + "$ref": "#/definitions/Expression" } } }, { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ - "public_key", + "hash", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519PublicKey" + "Blob" ] }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "hash": { + "$ref": "#/definitions/Blob" } } }, { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], "type": "object", "required": [ - "signature", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519Signature" + "Bytes" ] }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" + "value": { + "type": "string" } } + } + ] + }, + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" }, { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "discriminator": "1", + "type": "U8" + } + ], + "oneOf": [ + { "type": "object", "required": [ - "identifier", + "discriminator", "type" ], "properties": { "type": { "type": "string", "enum": [ - "Bucket" + "String" ] }, - "identifier": { - "$ref": "#/definitions/BucketId" + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" } } }, { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ - "identifier", + "discriminator", "type" ], "properties": { "type": { "type": "string", "enum": [ - "Proof" + "U8" ] }, - "identifier": { - "$ref": "#/definitions/ProofId" + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" } } + } + ] + }, + "ManifestAstValueKind": { + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "string", + "enum": [ + "Bool" + ] }, { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" } - } + ], + "type": "string", + "enum": [ + "U16" + ] }, { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } }, - "resource_address": { - "$ref": "#/definitions/Value" + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } } - } + ], + "type": "string", + "enum": [ + "Enum" + ] }, { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" } - } + ], + "type": "string", + "enum": [ + "None" + ] }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" } - } + ], + "type": "string", + "enum": [ + "Map" + ] }, { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" } - } - } - ] - }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, { - "type": "object", - "required": [ - "discriminator", - "type" + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" } - } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" } - } + ], + "type": "string", + "enum": [ + "Proof" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } } - } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" }, - "value": { - "type": "string" + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" } - } + ], + "type": "string", + "enum": [ + "Expression" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" } - } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2676,6 +4598,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2695,6 +4623,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2718,6 +4652,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2729,6 +4673,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2749,6 +4699,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2769,6 +4725,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2791,6 +4753,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2832,6 +4800,12 @@ "oneOf": [ { "description": "Cryptographic signature and public key for Ecdsa Secp256k1", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" + } + ], "type": "object", "required": [ "curve", @@ -2855,6 +4829,13 @@ }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" + } + ], "type": "object", "required": [ "curve", diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json index 6c09961a..c645f368 100644 --- a/schema/out/schema/compile_transaction_intent_request.json +++ b/schema/out/schema/compile_transaction_intent_request.json @@ -2,6 +2,31 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "CompileTransactionIntentRequest", "description": "Takes a transaction intent and compiles it by SBOR encoding it and returning it back to the caller. This is mainly useful when creating a transaction.", + "examples": [ + { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + } + ], "type": "object", "required": [ "header", @@ -28,6 +53,36 @@ "definitions": { "TransactionHeader": { "description": "A transaction header containing metadata and other transaction information.", + "examples": [ + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + } + ], "type": "object", "required": [ "cost_unit_limit", @@ -88,6 +143,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -110,6 +171,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", @@ -134,6 +201,15 @@ }, "TransactionManifest": { "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -161,6 +237,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -179,6 +261,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -206,6 +298,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -221,43 +399,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -272,35 +510,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -315,18 +583,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -334,6 +602,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -349,26 +655,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -376,6 +682,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -391,15 +745,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -407,10 +761,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -418,6 +772,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -434,7 +800,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -442,6 +808,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -455,10 +837,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -466,6 +848,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -480,18 +886,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -499,6 +905,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -513,15 +953,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -532,6 +972,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -545,10 +997,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -556,6 +1008,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -569,10 +1033,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -580,6 +1044,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -593,8 +1062,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -609,18 +1128,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -628,6 +1147,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -643,26 +1200,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -670,6 +1227,54 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -685,15 +1290,15 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -701,10 +1306,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -712,6 +1317,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -726,18 +1350,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -745,6 +1369,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -759,18 +1402,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -778,6 +1421,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -791,10 +1446,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -802,6 +1457,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -817,101 +1477,127 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", - "type": "object", - "required": [ - "abi", - "access_rules", - "code", - "instruction", - "metadata", - "royalty_config" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "PUBLISH_PACKAGE" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } } - } - }, - { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + ], "type": "object", "required": [ - "abi", + "access_rules", "code", "instruction", - "owner_badge" + "metadata", + "royalty_config", + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" + "PUBLISH_PACKAGE" ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -919,6 +1605,18 @@ }, { "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ "bucket", @@ -935,7 +1633,7 @@ "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -943,6 +1641,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -960,15 +1671,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -976,6 +1687,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -994,23 +1740,69 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1018,6 +1810,21 @@ }, { "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], "type": "object", "required": [ "instruction", @@ -1032,18 +1839,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1051,6 +1858,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -1065,18 +1896,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1084,6 +1915,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -1097,10 +1937,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1108,6 +1948,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -1121,10 +1970,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1132,10 +1981,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1151,31 +2031,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1183,6 +2055,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1197,18 +2082,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1216,6 +2101,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1230,18 +2130,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1249,6 +2149,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1263,18 +2204,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1282,11 +2223,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1298,85 +2259,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1384,13 +2362,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1400,85 +2445,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1486,13 +2540,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1503,42 +2600,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1546,6 +2627,18 @@ }, { "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], "type": "object", "required": [ "access_rule", @@ -1559,10 +2652,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1570,6 +2663,18 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], "type": "object", "required": [ "access_rule", @@ -1583,10 +2688,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1594,6 +2699,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1608,18 +2729,54 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "withdraw_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCOUNT" + ] + }, + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1627,11 +2784,27 @@ } ] }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], "oneOf": [ { "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -1651,6 +2824,12 @@ }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1671,6 +2850,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1691,6 +2876,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1711,6 +2902,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1731,6 +2928,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1751,6 +2954,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1771,6 +2980,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1791,6 +3006,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1811,6 +3032,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1831,6 +3058,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1851,6 +3084,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1870,6 +3109,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1883,7 +3164,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1897,13 +3178,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1917,12 +3207,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1937,7 +3232,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1951,12 +3255,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1970,12 +3283,32 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -1993,7 +3326,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2001,13 +3334,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -2026,7 +3388,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2034,7 +3396,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2045,10 +3407,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -2059,6 +3421,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -2074,13 +3456,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2101,6 +3489,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2120,26 +3514,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ "address", @@ -2149,7 +3538,7 @@ "type": { "type": "string", "enum": [ - "ComponentAddress" + "Address" ] }, "address": { @@ -2158,45 +3547,107 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "ResourceAddress" + "Bucket" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "Proof" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2206,187 +3657,107 @@ "type": { "type": "string", "enum": [ - "Hash" + "NonFungibleLocalId" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], "type": "object", "required": [ - "public_key", + "non_fungible_local_id", + "resource_address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1PublicKey" + "NonFungibleGlobalId" ] }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ "type", @@ -2406,6 +3777,12 @@ }, { "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ "hash", @@ -2425,6 +3802,12 @@ }, { "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], "type": "object", "required": [ "type", @@ -2446,6 +3829,16 @@ }, "EnumDiscriminator": { "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" + }, + { + "discriminator": "1", + "type": "U8" + } + ], "oneOf": [ { "type": "object", @@ -2488,159 +3881,619 @@ } ] }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "ManifestAstValueKind": { "oneOf": [ { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "Bool", + "value": true } - } + ], + "type": "string", + "enum": [ + "Bool" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } } - } + ], + "type": "string", + "enum": [ + "Enum" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], + "type": "string", + "enum": [ + "None" + ] + }, + { + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" }, - "value": { - "type": "string" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" } - } + ], + "type": "string", + "enum": [ + "Proof" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "value": { - "type": "string" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], + "type": "string", + "enum": [ + "Expression" + ] + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2651,6 +4504,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2670,6 +4529,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2693,6 +4558,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2704,6 +4579,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2724,6 +4605,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2744,6 +4631,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2766,6 +4659,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", diff --git a/schema/out/schema/convert_manifest_request.json b/schema/out/schema/convert_manifest_request.json index 813a5888..ed69e337 100644 --- a/schema/out/schema/convert_manifest_request.json +++ b/schema/out/schema/convert_manifest_request.json @@ -42,6 +42,15 @@ }, "TransactionManifest": { "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -69,6 +78,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -87,6 +102,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -114,6 +139,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -129,43 +240,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -180,35 +351,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -223,18 +424,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -242,6 +443,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -257,26 +496,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -284,6 +523,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -299,15 +586,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -315,10 +602,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -326,6 +613,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -342,7 +641,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -350,6 +649,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -363,10 +678,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -374,6 +689,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -388,18 +727,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -407,6 +746,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -421,15 +794,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -440,6 +813,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -453,10 +838,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -464,6 +849,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -477,10 +874,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -488,6 +885,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -501,8 +903,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -517,18 +969,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -536,6 +988,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -551,26 +1041,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -578,6 +1068,54 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -593,15 +1131,15 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -609,10 +1147,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -620,6 +1158,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -634,18 +1191,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -653,6 +1210,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -667,18 +1243,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -686,6 +1262,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -699,10 +1287,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -710,6 +1298,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -725,14 +1318,82 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } + } + ], "type": "object", "required": [ - "abi", "access_rules", "code", "instruction", "metadata", - "royalty_config" + "royalty_config", + "schema" ], "properties": { "instruction": { @@ -742,108 +1403,78 @@ ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ - "abi", - "code", - "instruction", - "owner_badge" + "bucket", + "instruction" ], "properties": { "instruction": { "type": "string", "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - } - } - }, - { - "description": "An instruction to burn a bucket of tokens.", - "type": "object", - "required": [ - "bucket", - "instruction" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "BURN_RESOURCE" + "BURN_RESOURCE" ] }, "bucket": { "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -851,6 +1482,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -868,15 +1512,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -884,6 +1528,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -902,23 +1581,69 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -926,6 +1651,21 @@ }, { "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], "type": "object", "required": [ "instruction", @@ -940,18 +1680,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -959,6 +1699,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -973,18 +1737,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -992,6 +1756,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -1005,10 +1778,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1016,6 +1789,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -1029,10 +1811,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1040,10 +1822,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1059,31 +1872,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1091,6 +1896,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1105,18 +1923,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1124,6 +1942,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1138,18 +1971,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1157,6 +1990,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1171,18 +2045,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1190,11 +2064,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1206,85 +2100,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1292,13 +2203,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1308,85 +2286,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1394,13 +2381,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1411,42 +2441,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1454,6 +2468,18 @@ }, { "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], "type": "object", "required": [ "access_rule", @@ -1467,10 +2493,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1478,6 +2504,18 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], "type": "object", "required": [ "access_rule", @@ -1491,10 +2529,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1502,6 +2540,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1516,49 +2570,107 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } - } - ] - }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", - "oneOf": [ + }, { - "description": "A boolean value which can either be true or false", + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ - "type", - "value" + "instruction", + "withdraw_rule" ], "properties": { - "type": { + "instruction": { "type": "string", "enum": [ - "Bool" + "CREATE_ACCOUNT" ] }, - "value": { - "type": "boolean" + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] } } - }, + } + ] + }, + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } + }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1579,6 +2691,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1599,6 +2717,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1619,6 +2743,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1639,6 +2769,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1659,6 +2795,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1679,6 +2821,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1699,6 +2847,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1719,6 +2873,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1739,6 +2899,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1759,6 +2925,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1778,6 +2950,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1791,7 +3005,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1805,13 +3019,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1825,12 +3048,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1845,7 +3073,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1859,12 +3096,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1878,12 +3124,32 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -1901,7 +3167,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -1909,13 +3175,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -1934,7 +3229,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -1942,7 +3237,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -1953,10 +3248,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -1967,6 +3262,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -1982,13 +3297,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2009,6 +3330,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2028,26 +3355,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ "address", @@ -2057,7 +3379,7 @@ "type": { "type": "string", "enum": [ - "ComponentAddress" + "Address" ] }, "address": { @@ -2066,45 +3388,107 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "ResourceAddress" + "Bucket" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "Proof" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2114,225 +3498,157 @@ "type": { "type": "string", "enum": [ - "Hash" + "NonFungibleLocalId" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], "type": "object", "required": [ - "public_key", + "non_fungible_local_id", + "resource_address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1PublicKey" + "NonFungibleGlobalId" ] }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ - "signature", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1Signature" + "Expression" ] }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" + "value": { + "$ref": "#/definitions/Expression" } } }, { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ - "public_key", + "hash", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519PublicKey" + "Blob" ] }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "hash": { + "$ref": "#/definitions/Blob" } } }, { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" } - } - }, - { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" - } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", "type": "object", "required": [ "type", @@ -2354,6 +3670,16 @@ }, "EnumDiscriminator": { "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" + }, + { + "discriminator": "1", + "type": "U8" + } + ], "oneOf": [ { "type": "object", @@ -2396,159 +3722,619 @@ } ] }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "ManifestAstValueKind": { "oneOf": [ { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "Bool", + "value": true } - } + ], + "type": "string", + "enum": [ + "Bool" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } } - } + ], + "type": "string", + "enum": [ + "Enum" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], + "type": "string", + "enum": [ + "None" + ] + }, + { + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" }, - "value": { - "type": "string" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" } - } + ], + "type": "string", + "enum": [ + "Proof" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "value": { - "type": "string" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], + "type": "string", + "enum": [ + "Expression" + ] + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2559,6 +4345,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2578,6 +4370,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2601,6 +4399,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2612,6 +4420,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2632,6 +4446,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2652,6 +4472,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2674,6 +4500,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", diff --git a/schema/out/schema/convert_manifest_response.json b/schema/out/schema/convert_manifest_response.json index d3cbfe97..5d79b043 100644 --- a/schema/out/schema/convert_manifest_response.json +++ b/schema/out/schema/convert_manifest_response.json @@ -2,6 +2,15 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "ConvertManifestResponse", "description": "The response of the [`ConvertManifestRequest`]", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -29,6 +38,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -47,6 +62,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -74,6 +99,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -89,43 +200,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -140,35 +311,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -183,18 +384,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -202,6 +403,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -217,26 +456,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -244,6 +483,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -259,15 +546,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -275,10 +562,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -286,6 +573,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -302,7 +601,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -310,6 +609,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -323,10 +638,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -334,6 +649,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -348,18 +687,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -367,6 +706,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -381,15 +754,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -400,6 +773,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -413,10 +798,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -424,6 +809,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -437,10 +834,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -448,6 +845,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -461,8 +863,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -477,18 +929,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -496,6 +948,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -511,26 +1001,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -538,6 +1028,54 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -553,15 +1091,15 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -569,10 +1107,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -580,6 +1118,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -594,18 +1151,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -613,6 +1170,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -627,18 +1203,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -646,6 +1222,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -659,10 +1247,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -670,6 +1258,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -685,14 +1278,82 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } + } + ], "type": "object", "required": [ - "abi", "access_rules", "code", "instruction", "metadata", - "royalty_config" + "royalty_config", + "schema" ], "properties": { "instruction": { @@ -702,84 +1363,42 @@ ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - } - } - }, - { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", - "type": "object", - "required": [ - "abi", - "code", - "instruction", - "owner_badge" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -787,6 +1406,18 @@ }, { "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ "bucket", @@ -803,7 +1434,7 @@ "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -811,6 +1442,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -828,15 +1472,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -844,6 +1488,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -862,34 +1541,95 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to modify the royalties of a package.", - "type": "object", - "required": [ - "instruction", - "package_address", + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], + "type": "object", + "required": [ + "instruction", + "package_address", "royalty_config" ], "properties": { @@ -900,18 +1640,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -919,6 +1659,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -933,18 +1697,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -952,6 +1716,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -965,10 +1738,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -976,6 +1749,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -989,10 +1771,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1000,10 +1782,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1019,31 +1832,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1051,6 +1856,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1065,18 +1883,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1084,6 +1902,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1098,18 +1931,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1117,6 +1950,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1131,18 +2005,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1150,11 +2024,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1166,85 +2060,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1252,13 +2163,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1268,85 +2246,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1354,13 +2341,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1371,42 +2401,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1414,6 +2428,18 @@ }, { "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], "type": "object", "required": [ "access_rule", @@ -1427,10 +2453,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1438,6 +2464,18 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], "type": "object", "required": [ "access_rule", @@ -1451,10 +2489,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1462,6 +2500,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1476,18 +2530,54 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "withdraw_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCOUNT" + ] + }, + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1495,11 +2585,27 @@ } ] }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], "oneOf": [ { "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -1519,6 +2625,12 @@ }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1539,6 +2651,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1559,6 +2677,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1579,6 +2703,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1599,6 +2729,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1619,6 +2755,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1639,6 +2781,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1659,6 +2807,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1679,6 +2833,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1699,6 +2859,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1719,6 +2885,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1738,6 +2910,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1751,7 +2965,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1765,13 +2979,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1785,12 +3008,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1805,7 +3033,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1819,12 +3056,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1838,18 +3084,38 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], "properties": { "type": { "type": "string", @@ -1861,7 +3127,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -1869,13 +3135,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -1894,7 +3189,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -1902,7 +3197,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -1913,10 +3208,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -1927,6 +3222,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -1942,13 +3257,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1969,6 +3290,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1988,64 +3315,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] - }, - "value": { - "$ref": "#/definitions/Own" + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ "address", @@ -2055,7 +3339,7 @@ "type": { "type": "string", "enum": [ - "PackageAddress" + "Address" ] }, "address": { @@ -2064,117 +3348,23 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -2194,6 +3384,22 @@ }, { "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ "identifier", @@ -2213,6 +3419,36 @@ }, { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2232,6 +3468,64 @@ }, { "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], "type": "object", "required": [ "non_fungible_local_id", @@ -2246,15 +3540,25 @@ ] }, "resource_address": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, "non_fungible_local_id": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ "type", @@ -2274,6 +3578,12 @@ }, { "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ "hash", @@ -2293,6 +3603,12 @@ }, { "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], "type": "object", "required": [ "type", @@ -2314,6 +3630,16 @@ }, "EnumDiscriminator": { "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" + }, + { + "discriminator": "1", + "type": "U8" + } + ], "oneOf": [ { "type": "object", @@ -2356,159 +3682,619 @@ } ] }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "ManifestAstValueKind": { "oneOf": [ { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + "type": "string", + "enum": [ + "Bool" + ] + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" } - } + ], + "type": "string", + "enum": [ + "U8" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" } - } + ], + "type": "string", + "enum": [ + "U32" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } } - } + ], + "type": "string", + "enum": [ + "Enum" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], + "type": "string", + "enum": [ + "None" + ] + }, + { + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + ], + "type": "string", + "enum": [ + "Address" + ] + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" }, - "value": { - "type": "string" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" } - } + ], + "type": "string", + "enum": [ + "Bucket" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] + "type": "string", + "enum": [ + "Proof" + ] + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } }, - "value": { - "type": "string" + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } } - } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], + "type": "string", + "enum": [ + "Expression" + ] + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2519,6 +4305,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2538,6 +4330,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2561,6 +4359,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2572,6 +4380,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2592,6 +4406,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2612,6 +4432,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2634,6 +4460,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", diff --git a/schema/out/schema/decode_address_response.json b/schema/out/schema/decode_address_response.json index 34d945cf..1e1ebae7 100644 --- a/schema/out/schema/decode_address_response.json +++ b/schema/out/schema/decode_address_response.json @@ -44,7 +44,8 @@ "description": "An enum describing the different entity types in the Radix Engine and Scrypto", "type": "string", "enum": [ - "Resource", + "FungibleResource", + "NonFungibleResource", "Package", "NormalComponent", "AccountComponent", diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json index 2aa978a5..d206c794 100644 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ b/schema/out/schema/decompile_notarized_transaction_response.json @@ -2,6 +2,81 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "DecompileNotarizedTransactionResponse", "description": "The response from [`DecompileNotarizedTransactionRequest`].", + "examples": [ + { + "notary_signature": { + "curve": "EcdsaSecp256k1", + "signature": "017c36e8850679465e3beb4d8d945ec1875adb715cf62c2112025064b0a77a6ca818444970c69eafd2ed2ee1f50443498064aa477773a6dda5f49bfb84e2c4b834" + }, + "signed_intent": { + "intent": { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "008db363f3dfda37dfc9e7d45eb72c2405939124b3b962df506fa9cca0017be0092e1341b79694228c4f53c80e790ef9258aafbf5051769a126ddf588016ad282f" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0174adbe3362c446ea2368ee1986864edc18f3eefc8b9ea0162756f04ffed310450a327cb3f8873070fc607844acec45b46490b4892fc4110c920ae28251b79100" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "01f55560f0fd9c1a90fca4a01c0e6cb613840ecd0a07fec7401e5e51b93f44df15586ec4a3d33a1811a6238e397e9964a1126ff32378dc5626c5126499ba3aac44" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "003fbca8a171f60a9a30a93fce9e846f130fee2a5989b7a93212877bf38f0afbb82ba7c9b718882bbf99a97f74fca1fe86ab4e6d85238873b29e851c193a48222e" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "0903d71eb96aa704338365d3ae15c0e8ca08d29aa1828a0439ecd0f0b64ba3fbee4f44c0bd694d08be51ebbb7d07c61961875894938b827627e5a77367b7320d" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "fce6e33719e6bf51f0ebe35cfe1ba26ce167063da7c7eaf48ecde64e3eb21bfcc2752c793c36a04493f52798bfcaaca66af70d889655067b1b5f3014f6cc7b0b" + }, + { + "curve": "EddsaEd25519", + "public_key": "fd50b8e3b144ea244fbf7737f550bc8dd0c2650bbc1aada833ca17ff8dbf329b", + "signature": "0a57400709fa697cc26268e959f29b1bc1d5fb6ed9b6a75381ca610cb9208f3a51ea72eced28e8e0636693a27e5019435827624e599aad30bfca4abbdae58b09" + }, + { + "curve": "EddsaEd25519", + "public_key": "fde4fba030ad002f7c2f7d4c331f49d13fb0ec747eceebec634f1ff4cbca9def", + "signature": "b3e149d3ce05f5e0e692e449095c8c0afbf0e51bd226ce087dd6f927c351240481440518695ed9521af29abac1e4fd59bf58ed251c0522dd55eda773d2b83504" + } + ] + } + } + ], "type": "object", "required": [ "notary_signature", @@ -28,6 +103,75 @@ "definitions": { "SignedTransactionIntent": { "description": "A signed transaction intent which is made up of the intent as well as the intent signatures.", + "examples": [ + { + "intent": { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "008db363f3dfda37dfc9e7d45eb72c2405939124b3b962df506fa9cca0017be0092e1341b79694228c4f53c80e790ef9258aafbf5051769a126ddf588016ad282f" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0174adbe3362c446ea2368ee1986864edc18f3eefc8b9ea0162756f04ffed310450a327cb3f8873070fc607844acec45b46490b4892fc4110c920ae28251b79100" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "01f55560f0fd9c1a90fca4a01c0e6cb613840ecd0a07fec7401e5e51b93f44df15586ec4a3d33a1811a6238e397e9964a1126ff32378dc5626c5126499ba3aac44" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "003fbca8a171f60a9a30a93fce9e846f130fee2a5989b7a93212877bf38f0afbb82ba7c9b718882bbf99a97f74fca1fe86ab4e6d85238873b29e851c193a48222e" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "0903d71eb96aa704338365d3ae15c0e8ca08d29aa1828a0439ecd0f0b64ba3fbee4f44c0bd694d08be51ebbb7d07c61961875894938b827627e5a77367b7320d" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "fce6e33719e6bf51f0ebe35cfe1ba26ce167063da7c7eaf48ecde64e3eb21bfcc2752c793c36a04493f52798bfcaaca66af70d889655067b1b5f3014f6cc7b0b" + }, + { + "curve": "EddsaEd25519", + "public_key": "fd50b8e3b144ea244fbf7737f550bc8dd0c2650bbc1aada833ca17ff8dbf329b", + "signature": "0a57400709fa697cc26268e959f29b1bc1d5fb6ed9b6a75381ca610cb9208f3a51ea72eced28e8e0636693a27e5019435827624e599aad30bfca4abbdae58b09" + }, + { + "curve": "EddsaEd25519", + "public_key": "fde4fba030ad002f7c2f7d4c331f49d13fb0ec747eceebec634f1ff4cbca9def", + "signature": "b3e149d3ce05f5e0e692e449095c8c0afbf0e51bd226ce087dd6f927c351240481440518695ed9521af29abac1e4fd59bf58ed251c0522dd55eda773d2b83504" + } + ] + } + ], "type": "object", "required": [ "intent", @@ -53,6 +197,31 @@ }, "TransactionIntent": { "description": "A transaction intent which is made of the header containing the transaction metadata and a manifest consisting of the instructions and blobs.", + "examples": [ + { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + } + ], "type": "object", "required": [ "header", @@ -79,6 +248,36 @@ }, "TransactionHeader": { "description": "A transaction header containing metadata and other transaction information.", + "examples": [ + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + } + ], "type": "object", "required": [ "cost_unit_limit", @@ -139,6 +338,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -161,6 +366,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", @@ -185,6 +396,15 @@ }, "TransactionManifest": { "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -212,6 +432,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -230,6 +456,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -257,6 +493,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -272,43 +594,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -323,35 +705,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -366,18 +778,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -385,6 +797,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -400,26 +850,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -427,6 +877,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -442,15 +940,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -458,10 +956,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -469,6 +967,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -485,7 +995,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -493,6 +1003,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -506,10 +1032,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -517,6 +1043,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -531,18 +1081,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -550,6 +1100,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -564,15 +1148,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -583,6 +1167,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -596,10 +1192,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -607,6 +1203,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -620,10 +1228,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -631,6 +1239,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -644,8 +1257,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -660,18 +1323,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -679,6 +1342,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -694,26 +1395,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -721,30 +1422,78 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", - "type": "object", - "required": [ - "ids", - "instruction", - "into_proof", - "resource_address" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" - ] - }, - "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", - "allOf": [ + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], + "type": "object", + "required": [ + "ids", + "instruction", + "into_proof", + "resource_address" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS" + ] + }, + "resource_address": { + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", + "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -752,10 +1501,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -763,6 +1512,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -777,18 +1545,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -796,6 +1564,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -810,18 +1597,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -829,6 +1616,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -842,10 +1641,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -853,6 +1652,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -868,14 +1672,82 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } + } + ], "type": "object", "required": [ - "abi", "access_rules", "code", "instruction", "metadata", - "royalty_config" + "royalty_config", + "schema" ], "properties": { "instruction": { @@ -885,84 +1757,42 @@ ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - } - } - }, - { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", - "type": "object", - "required": [ - "abi", - "code", - "instruction", - "owner_badge" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -970,6 +1800,18 @@ }, { "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ "bucket", @@ -986,7 +1828,7 @@ "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -994,6 +1836,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -1011,15 +1866,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1027,6 +1882,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -1045,23 +1935,69 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1069,6 +2005,21 @@ }, { "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], "type": "object", "required": [ "instruction", @@ -1083,18 +2034,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1102,6 +2053,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -1116,18 +2091,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1135,6 +2110,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -1148,10 +2132,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1159,6 +2143,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -1172,10 +2165,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1183,10 +2176,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1202,31 +2226,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1234,6 +2250,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1248,18 +2277,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1267,6 +2296,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1281,18 +2325,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1300,6 +2344,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1314,18 +2399,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1333,11 +2418,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1349,85 +2454,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1435,13 +2557,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1451,85 +2640,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1537,13 +2735,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1554,42 +2795,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1597,6 +2822,18 @@ }, { "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], "type": "object", "required": [ "access_rule", @@ -1610,10 +2847,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1621,6 +2858,18 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], "type": "object", "required": [ "access_rule", @@ -1634,10 +2883,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1645,6 +2894,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1659,18 +2924,54 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "withdraw_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCOUNT" + ] + }, + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1678,11 +2979,27 @@ } ] }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], "oneOf": [ { "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -1702,6 +3019,12 @@ }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1722,6 +3045,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1742,6 +3071,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1762,6 +3097,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1782,6 +3123,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1802,6 +3149,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1822,6 +3175,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1842,6 +3201,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1862,6 +3227,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1882,6 +3253,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1902,6 +3279,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1921,6 +3304,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1934,7 +3359,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1948,13 +3373,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1968,12 +3402,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1988,7 +3427,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -2002,12 +3450,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -2021,12 +3478,32 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -2044,7 +3521,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2052,13 +3529,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -2077,7 +3583,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2085,7 +3591,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2096,10 +3602,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -2110,6 +3616,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -2125,13 +3651,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2152,6 +3684,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2171,26 +3709,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ "address", @@ -2200,7 +3733,7 @@ "type": { "type": "string", "enum": [ - "ComponentAddress" + "Address" ] }, "address": { @@ -2209,45 +3742,107 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "ResourceAddress" + "Bucket" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "Proof" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2257,441 +3852,843 @@ "type": { "type": "string", "enum": [ - "Hash" + "NonFungibleLocalId" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + ], "type": "object", "required": [ - "signature", + "non_fungible_local_id", + "resource_address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1Signature" + "NonFungibleGlobalId" ] }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ - "public_key", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519PublicKey" + "Expression" ] }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "value": { + "$ref": "#/definitions/Expression" } } }, { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ - "signature", + "hash", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519Signature" + "Blob" ] }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" + "hash": { + "$ref": "#/definitions/Blob" } } }, { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], "type": "object", "required": [ - "identifier", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "Bucket" + "Bytes" ] }, - "identifier": { - "$ref": "#/definitions/BucketId" + "value": { + "type": "string" } } + } + ] + }, + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" }, { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "discriminator": "1", + "type": "U8" + } + ], + "oneOf": [ + { "type": "object", "required": [ - "identifier", + "discriminator", "type" ], "properties": { "type": { "type": "string", "enum": [ - "Proof" + "String" ] }, - "identifier": { - "$ref": "#/definitions/ProofId" + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" } } }, { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "type": "object", "required": [ - "type", - "value" + "discriminator", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "NonFungibleLocalId" + "U8" ] }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" } } + } + ] + }, + "ManifestAstValueKind": { + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "string", + "enum": [ + "Bool" + ] }, { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } }, - "resource_address": { - "$ref": "#/definitions/Value" + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } } - } + ], + "type": "string", + "enum": [ + "Enum" + ] }, { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" } - } + ], + "type": "string", + "enum": [ + "None" + ] }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } } - } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] }, { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" } - } - } - ] - }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, { - "type": "object", - "required": [ - "discriminator", - "type" + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" } - } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" } - } + ], + "type": "string", + "enum": [ + "Proof" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } } - } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" }, - "value": { - "type": "string" + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" } - } + ], + "type": "string", + "enum": [ + "Expression" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" } - } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2702,6 +4699,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2721,6 +4724,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2744,6 +4753,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2755,6 +4774,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2775,6 +4800,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2795,6 +4826,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2817,6 +4854,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2858,6 +4901,12 @@ "oneOf": [ { "description": "Cryptographic signature and public key for Ecdsa Secp256k1", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" + } + ], "type": "object", "required": [ "curve", @@ -2881,6 +4930,13 @@ }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" + } + ], "type": "object", "required": [ "curve", @@ -2917,6 +4973,12 @@ "oneOf": [ { "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" + } + ], "type": "object", "required": [ "curve", @@ -2939,6 +5001,12 @@ }, { "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" + } + ], "type": "object", "required": [ "curve", diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json index 73e3d849..1d9dd1a0 100644 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ b/schema/out/schema/decompile_signed_transaction_intent_response.json @@ -2,6 +2,75 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "DecompileSignedTransactionIntentResponse", "description": "The response from [`DecompileSignedTransactionIntentRequest`].", + "examples": [ + { + "intent": { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "008db363f3dfda37dfc9e7d45eb72c2405939124b3b962df506fa9cca0017be0092e1341b79694228c4f53c80e790ef9258aafbf5051769a126ddf588016ad282f" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0174adbe3362c446ea2368ee1986864edc18f3eefc8b9ea0162756f04ffed310450a327cb3f8873070fc607844acec45b46490b4892fc4110c920ae28251b79100" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "01f55560f0fd9c1a90fca4a01c0e6cb613840ecd0a07fec7401e5e51b93f44df15586ec4a3d33a1811a6238e397e9964a1126ff32378dc5626c5126499ba3aac44" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "003fbca8a171f60a9a30a93fce9e846f130fee2a5989b7a93212877bf38f0afbb82ba7c9b718882bbf99a97f74fca1fe86ab4e6d85238873b29e851c193a48222e" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "0903d71eb96aa704338365d3ae15c0e8ca08d29aa1828a0439ecd0f0b64ba3fbee4f44c0bd694d08be51ebbb7d07c61961875894938b827627e5a77367b7320d" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "fce6e33719e6bf51f0ebe35cfe1ba26ce167063da7c7eaf48ecde64e3eb21bfcc2752c793c36a04493f52798bfcaaca66af70d889655067b1b5f3014f6cc7b0b" + }, + { + "curve": "EddsaEd25519", + "public_key": "fd50b8e3b144ea244fbf7737f550bc8dd0c2650bbc1aada833ca17ff8dbf329b", + "signature": "0a57400709fa697cc26268e959f29b1bc1d5fb6ed9b6a75381ca610cb9208f3a51ea72eced28e8e0636693a27e5019435827624e599aad30bfca4abbdae58b09" + }, + { + "curve": "EddsaEd25519", + "public_key": "fde4fba030ad002f7c2f7d4c331f49d13fb0ec747eceebec634f1ff4cbca9def", + "signature": "b3e149d3ce05f5e0e692e449095c8c0afbf0e51bd226ce087dd6f927c351240481440518695ed9521af29abac1e4fd59bf58ed251c0522dd55eda773d2b83504" + } + ] + } + ], "type": "object", "required": [ "intent", @@ -27,6 +96,31 @@ "definitions": { "TransactionIntent": { "description": "A transaction intent which is made of the header containing the transaction metadata and a manifest consisting of the instructions and blobs.", + "examples": [ + { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + } + ], "type": "object", "required": [ "header", @@ -53,6 +147,36 @@ }, "TransactionHeader": { "description": "A transaction header containing metadata and other transaction information.", + "examples": [ + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + } + ], "type": "object", "required": [ "cost_unit_limit", @@ -113,6 +237,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -135,6 +265,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", @@ -159,6 +295,15 @@ }, "TransactionManifest": { "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -186,6 +331,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -204,6 +355,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -231,6 +392,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -246,43 +493,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -297,35 +604,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -340,18 +677,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -359,6 +696,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -374,26 +749,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -401,6 +776,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -416,15 +839,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -432,10 +855,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -443,6 +866,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -459,7 +894,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -467,6 +902,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -480,10 +931,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -491,6 +942,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -505,18 +980,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -524,6 +999,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -538,15 +1047,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -557,6 +1066,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -570,10 +1091,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -581,6 +1102,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -594,10 +1127,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -605,6 +1138,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -618,8 +1156,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -634,18 +1222,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -653,6 +1241,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -668,26 +1294,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -695,6 +1321,54 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -710,15 +1384,15 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -726,10 +1400,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -737,6 +1411,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -751,18 +1444,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -770,6 +1463,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -784,18 +1496,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -803,6 +1515,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -816,10 +1540,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -827,6 +1551,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -842,14 +1571,82 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } + } + ], "type": "object", "required": [ - "abi", "access_rules", "code", "instruction", "metadata", - "royalty_config" + "royalty_config", + "schema" ], "properties": { "instruction": { @@ -859,84 +1656,42 @@ ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - } - } - }, - { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", - "type": "object", - "required": [ - "abi", - "code", - "instruction", - "owner_badge" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -944,6 +1699,18 @@ }, { "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ "bucket", @@ -960,7 +1727,7 @@ "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -968,6 +1735,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -985,15 +1765,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1001,6 +1781,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -1019,23 +1834,69 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1043,6 +1904,21 @@ }, { "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], "type": "object", "required": [ "instruction", @@ -1057,18 +1933,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1076,6 +1952,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -1090,18 +1990,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1109,6 +2009,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -1122,10 +2031,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1133,6 +2042,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -1146,10 +2064,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1157,10 +2075,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1176,31 +2125,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1208,6 +2149,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1222,18 +2176,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1241,6 +2195,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1255,18 +2224,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1274,6 +2243,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1288,18 +2298,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1307,11 +2317,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1323,85 +2353,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1409,13 +2456,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1425,85 +2539,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1511,13 +2634,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1528,42 +2694,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1571,6 +2721,18 @@ }, { "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], "type": "object", "required": [ "access_rule", @@ -1584,10 +2746,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1595,8 +2757,20 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", - "type": "object", - "required": [ + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], + "type": "object", + "required": [ "access_rule", "instruction" ], @@ -1608,10 +2782,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1619,6 +2793,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1633,18 +2823,54 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "withdraw_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCOUNT" + ] + }, + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1652,11 +2878,27 @@ } ] }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], "oneOf": [ { "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -1676,6 +2918,12 @@ }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1696,6 +2944,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1716,6 +2970,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1736,6 +2996,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1756,6 +3022,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1776,6 +3048,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1796,6 +3074,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1816,6 +3100,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1836,6 +3126,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1856,6 +3152,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1876,6 +3178,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1895,6 +3203,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1908,7 +3258,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1922,13 +3272,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1942,12 +3301,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1962,7 +3326,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1976,12 +3349,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1995,12 +3377,32 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -2018,7 +3420,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2026,13 +3428,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -2051,7 +3482,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2059,7 +3490,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2070,10 +3501,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -2084,6 +3515,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -2099,13 +3550,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2126,6 +3583,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2145,26 +3608,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ "address", @@ -2174,7 +3632,7 @@ "type": { "type": "string", "enum": [ - "ComponentAddress" + "Address" ] }, "address": { @@ -2183,45 +3641,107 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "ResourceAddress" + "Bucket" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "Proof" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2231,441 +3751,843 @@ "type": { "type": "string", "enum": [ - "Hash" + "NonFungibleLocalId" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], "type": "object", "required": [ - "public_key", + "non_fungible_local_id", + "resource_address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1PublicKey" + "NonFungibleGlobalId" ] }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ - "signature", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1Signature" + "Expression" ] }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" + "value": { + "$ref": "#/definitions/Expression" } } }, { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ - "public_key", + "hash", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519PublicKey" + "Blob" ] }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "hash": { + "$ref": "#/definitions/Blob" } } }, { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], "type": "object", "required": [ - "signature", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519Signature" + "Bytes" ] }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" + "value": { + "type": "string" } } + } + ] + }, + "EnumDiscriminator": { + "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" }, { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "discriminator": "1", + "type": "U8" + } + ], + "oneOf": [ + { "type": "object", "required": [ - "identifier", + "discriminator", "type" ], "properties": { "type": { "type": "string", "enum": [ - "Bucket" + "String" ] }, - "identifier": { - "$ref": "#/definitions/BucketId" + "discriminator": { + "description": "A string discriminator of the fully qualified well-known enum name", + "type": "string" } } }, { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ - "identifier", + "discriminator", "type" ], "properties": { "type": { "type": "string", "enum": [ - "Proof" + "U8" ] }, - "identifier": { - "$ref": "#/definitions/ProofId" + "discriminator": { + "description": "An 8-bit unsigned integer serialized as a string.", + "type": "string", + "pattern": "[0-9]+" } } + } + ] + }, + "ManifestAstValueKind": { + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "string", + "enum": [ + "Bool" + ] }, { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" } - } + ], + "type": "string", + "enum": [ + "U16" + ] }, { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } }, - "resource_address": { - "$ref": "#/definitions/Value" + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } } - } + ], + "type": "string", + "enum": [ + "Enum" + ] }, { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" } - } + ], + "type": "string", + "enum": [ + "None" + ] }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" } - } + ], + "type": "string", + "enum": [ + "Map" + ] }, { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" } - } - } - ] - }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, { - "type": "object", - "required": [ - "discriminator", - "type" + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" } - } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" } - } + ], + "type": "string", + "enum": [ + "Proof" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } } - } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" }, - "value": { - "type": "string" + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" } - } + ], + "type": "string", + "enum": [ + "Expression" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" } - } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2676,6 +4598,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2695,6 +4623,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2718,6 +4652,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2729,6 +4673,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2749,6 +4699,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2769,6 +4725,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2791,6 +4753,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2832,6 +4800,12 @@ "oneOf": [ { "description": "Cryptographic signature and public key for Ecdsa Secp256k1", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" + } + ], "type": "object", "required": [ "curve", @@ -2855,6 +4829,13 @@ }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" + } + ], "type": "object", "required": [ "curve", diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json index 1afe7ba3..39f0083a 100644 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ b/schema/out/schema/decompile_transaction_intent_response.json @@ -2,6 +2,31 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "DecompileTransactionIntentResponse", "description": "The response from [`DecompileTransactionIntentRequest`].", + "examples": [ + { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + } + ], "type": "object", "required": [ "header", @@ -28,6 +53,36 @@ "definitions": { "TransactionHeader": { "description": "A transaction header containing metadata and other transaction information.", + "examples": [ + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + } + ], "type": "object", "required": [ "cost_unit_limit", @@ -88,6 +143,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -110,6 +171,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", @@ -134,6 +201,15 @@ }, "TransactionManifest": { "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -161,6 +237,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -179,6 +261,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -206,6 +298,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -221,43 +399,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -272,35 +510,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -315,18 +583,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -334,6 +602,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -349,26 +655,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -376,6 +682,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -391,15 +745,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -407,10 +761,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -418,6 +772,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -434,7 +800,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -442,6 +808,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -455,10 +837,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -466,6 +848,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -480,18 +886,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -499,6 +905,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -513,15 +953,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -532,6 +972,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -545,10 +997,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -556,6 +1008,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -569,10 +1033,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -580,6 +1044,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -593,8 +1062,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -609,18 +1128,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -628,6 +1147,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -643,26 +1200,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -670,6 +1227,54 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -685,15 +1290,15 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -701,10 +1306,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -712,6 +1317,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -726,18 +1350,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -745,6 +1369,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -759,18 +1402,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -778,6 +1421,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -791,10 +1446,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -802,6 +1457,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -817,101 +1477,127 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", - "type": "object", - "required": [ - "abi", - "access_rules", - "code", - "instruction", - "metadata", - "royalty_config" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "PUBLISH_PACKAGE" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } } - } - }, - { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + ], "type": "object", "required": [ - "abi", + "access_rules", "code", "instruction", - "owner_badge" + "metadata", + "royalty_config", + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" + "PUBLISH_PACKAGE" ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -919,6 +1605,18 @@ }, { "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ "bucket", @@ -935,7 +1633,7 @@ "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -943,6 +1641,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -960,15 +1671,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -976,6 +1687,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -994,23 +1740,69 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1018,6 +1810,21 @@ }, { "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], "type": "object", "required": [ "instruction", @@ -1032,18 +1839,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1051,6 +1858,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -1065,18 +1896,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1084,6 +1915,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -1097,10 +1937,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1108,6 +1948,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -1121,10 +1970,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1132,10 +1981,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1151,31 +2031,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1183,6 +2055,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1197,18 +2082,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1216,6 +2101,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1230,18 +2130,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1249,6 +2149,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1263,18 +2204,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1282,11 +2223,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1298,85 +2259,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1384,13 +2362,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1400,85 +2445,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1486,13 +2540,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1503,42 +2600,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1546,6 +2627,18 @@ }, { "description": "Creates a new identity native component with the passed access rule.", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], "type": "object", "required": [ "access_rule", @@ -1559,10 +2652,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1570,6 +2663,18 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], "type": "object", "required": [ "access_rule", @@ -1583,10 +2688,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1594,6 +2699,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1608,18 +2729,54 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "withdraw_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCOUNT" + ] + }, + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1627,11 +2784,27 @@ } ] }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], "oneOf": [ { "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -1651,6 +2824,12 @@ }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1671,6 +2850,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1691,6 +2876,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1711,6 +2902,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1731,6 +2928,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1751,6 +2954,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1771,6 +2980,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1791,6 +3006,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1811,6 +3032,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1831,6 +3058,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1851,6 +3084,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1870,6 +3109,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1883,7 +3164,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1897,13 +3178,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1917,12 +3207,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1937,7 +3232,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1951,12 +3255,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1970,12 +3283,32 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -1993,7 +3326,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2001,13 +3334,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -2026,7 +3388,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2034,7 +3396,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2045,10 +3407,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -2059,6 +3421,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -2074,13 +3456,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2101,6 +3489,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2120,26 +3514,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ "address", @@ -2149,7 +3538,7 @@ "type": { "type": "string", "enum": [ - "ComponentAddress" + "Address" ] }, "address": { @@ -2158,45 +3547,107 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "ResourceAddress" + "Bucket" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "Proof" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2206,187 +3657,107 @@ "type": { "type": "string", "enum": [ - "Hash" + "NonFungibleLocalId" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], "type": "object", "required": [ - "public_key", + "non_fungible_local_id", + "resource_address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1PublicKey" + "NonFungibleGlobalId" ] }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ "type", @@ -2406,6 +3777,12 @@ }, { "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ "hash", @@ -2425,6 +3802,12 @@ }, { "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], "type": "object", "required": [ "type", @@ -2446,6 +3829,16 @@ }, "EnumDiscriminator": { "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" + }, + { + "discriminator": "1", + "type": "U8" + } + ], "oneOf": [ { "type": "object", @@ -2488,159 +3881,619 @@ } ] }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "ManifestAstValueKind": { "oneOf": [ { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "Bool", + "value": true } - } + ], + "type": "string", + "enum": [ + "Bool" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } } - } + ], + "type": "string", + "enum": [ + "Enum" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], + "type": "string", + "enum": [ + "None" + ] + }, + { + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" }, - "value": { - "type": "string" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" } - } + ], + "type": "string", + "enum": [ + "Proof" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" }, - "value": { - "type": "string" + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" } - } + ], + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], + "type": "string", + "enum": [ + "Expression" + ] + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2651,6 +4504,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2670,6 +4529,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2693,6 +4558,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2704,6 +4579,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2724,6 +4605,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2744,6 +4631,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2766,6 +4659,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json index a71ccd07..b982e1e9 100644 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ b/schema/out/schema/decompile_unknown_transaction_intent_response.json @@ -61,6 +61,31 @@ "definitions": { "DecompileTransactionIntentResponse": { "description": "The response from [`DecompileTransactionIntentRequest`].", + "examples": [ + { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + } + ], "type": "object", "required": [ "header", @@ -87,6 +112,36 @@ }, "TransactionHeader": { "description": "A transaction header containing metadata and other transaction information.", + "examples": [ + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + } + ], "type": "object", "required": [ "cost_unit_limit", @@ -147,6 +202,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -169,6 +230,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", @@ -193,6 +260,15 @@ }, "TransactionManifest": { "description": "A transaction intent consisting of instructions as well as blobs", + "examples": [ + { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + ], "type": "object", "required": [ "blobs", @@ -220,6 +296,12 @@ "description": "A discriminated union of possible representations of manifest instructions. Currently, two representations are supported: a string representation which is the same as that seen in the local simulator, resim, and pretty much everywhere, as well as a parsed format which is a vector of instructions where each instruction is represented through the `Instruction` model.", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + ], "type": "object", "required": [ "type", @@ -238,6 +320,16 @@ } }, { + "examples": [ + { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + ], "type": "object", "required": [ "type", @@ -265,6 +357,92 @@ "oneOf": [ { "description": "An instruction to call a function with the given list of arguments on the given package address and blueprint name.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "blueprint_name": { + "type": "String", + "value": "Faucet" + }, + "function_name": { + "type": "String", + "value": "new" + }, + "instruction": "CALL_FUNCTION", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "blueprint_name", @@ -280,43 +458,103 @@ ] }, "package_address": { - "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `Value` model.", + "description": "The address of the package containing the blueprint that contains the desired function. This package address is serialized as the `PackageAddress` variant of the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "blueprint_name": { - "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the blueprint containing the desired function. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "function_name": { - "description": "A string of the name of the function to call. This field is serialized as a `String` from the Value model.", + "description": "A string of the name of the function to call. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the function with. If this array is empty or is not provided, then the function is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to call a method with a given name on a given component address with the given list of arguments.", + "examples": [ + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": [ + { + "type": "Decimal", + "value": "1" + } + ], + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + }, + { + "arguments": null, + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CALL_METHOD", + "method_name": { + "type": "String", + "value": "free" + } + } + ], "type": "object", "required": [ "component_address", @@ -331,35 +569,65 @@ ] }, "component_address": { - "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The address of the component which contains the method to be invoked. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "method_name": { - "description": "A string of the name of the method to call. his field is serialized as a `String` from the Value model.", + "description": "A string of the name of the method to call. his field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "arguments": { - "description": "An optional array of `Value` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", + "description": "An optional array of `ManifestAstValue` arguments to call the method with. If this array is empty or is not provided, then the method is called with no arguments.", "type": [ "array", "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "An instruction to take the entire amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "TAKE_FROM_WORKTOP", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -374,18 +642,18 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -393,6 +661,44 @@ }, { "description": "An instruction to take the an amount of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "TAKE_FROM_WORKTOP_BY_AMOUNT", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -408,26 +714,26 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to take from the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -435,6 +741,54 @@ }, { "description": "An instruction to take the a set of non-fungible ids of a given resource address from the worktop and put it in a bucket.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "TAKE_FROM_WORKTOP_BY_IDS", + "into_bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -450,15 +804,15 @@ ] }, "resource_address": { - "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to take from the worktop. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to take from the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -466,10 +820,10 @@ "uniqueItems": true }, "into_bucket": { - "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the Value model.", + "description": "A bucket to put the taken resources into. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -477,6 +831,18 @@ }, { "description": "Returns a bucket of tokens to the worktop.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "RETURN_TO_WORKTOP" + } + ], "type": "object", "required": [ "bucket", @@ -493,7 +859,7 @@ "description": "The bucket to return to the worktop.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -501,6 +867,22 @@ }, { "description": "An instruction to assert that a given resource exists in the worktop.", + "examples": [ + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "ASSERT_WORKTOP_CONTAINS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -514,10 +896,10 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -525,6 +907,30 @@ }, { "description": "An instruction to assert that a specific amount of a specific resource address exists in the worktop.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_AMOUNT", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -539,18 +945,18 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to assert their existence in the worktop. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -558,6 +964,40 @@ }, { "description": "An instruction to assert that a set ids of a specific resource address exists in the worktop.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "ASSERT_WORKTOP_CONTAINS_BY_IDS", + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -572,15 +1012,15 @@ ] }, "resource_address": { - "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to perform the assertion on. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids of the resource to assert their existence in the worktop. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -591,6 +1031,18 @@ }, { "description": "An instruction which pops a proof from the AuthZone stack and into an identifiable proof", + "examples": [ + { + "instruction": "POP_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -604,10 +1056,10 @@ ] }, "into_proof": { - "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the Value model.", + "description": "The proof to put the popped proof into. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -615,6 +1067,18 @@ }, { "description": "An instruction that pushes a proof to the auth zone stack.", + "examples": [ + { + "instruction": "PUSH_TO_AUTH_ZONE", + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -628,10 +1092,10 @@ ] }, "proof": { - "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the Value model.", + "description": "The proof to push to the auth zone stack. This is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -639,6 +1103,11 @@ }, { "description": "An instruction which clears the auth zone stack by dropping all of the proofs in that stack.", + "examples": [ + { + "instruction": "CLEAR_AUTH_ZONE" + } + ], "type": "object", "required": [ "instruction" @@ -652,8 +1121,58 @@ } } }, + { + "description": "Clears all the proofs of signature virtual badges.", + "examples": [ + { + "instruction": "CLEAR_SIGNATURE_PROOFS" + } + ], + "type": "object", + "required": [ + "instruction" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CLEAR_SIGNATURE_PROOFS" + ] + } + } + }, { "description": "An instruction to create a proof of the entire amount of a given resource address from the auth zone.", + "examples": [ + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -668,18 +1187,18 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -687,6 +1206,44 @@ }, { "description": "An instruction to create a proof of the an amount of a given resource address from the auth zone.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_AMOUNT", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -702,26 +1259,26 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of the resource to create a proof of. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -729,6 +1286,54 @@ }, { "description": "An instruction to create a proof of the a set of non-fungible ids of a given resource address from the auth zone.", + "examples": [ + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + }, + { + "ids": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + } + ], + "instruction": "CREATE_PROOF_FROM_AUTH_ZONE_BY_IDS", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + }, + "resource_address": { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + } + } + ], "type": "object", "required": [ "ids", @@ -744,15 +1349,15 @@ ] }, "resource_address": { - "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to create a proof of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "ids": { - "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the Value model.", + "description": "The non-fungible ids to create a proof of. This is a set (serialized as a JSON array) of `NonFungibleLocalId`s from the ManifestAstValue model.", "type": "array", "items": { "$ref": "#/definitions/NonFungibleLocalId" @@ -760,10 +1365,10 @@ "uniqueItems": true }, "into_proof": { - "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the Value model.", + "description": "A proof to put the resource proof into. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -771,6 +1376,25 @@ }, { "description": "An instruction to create a proof given a bucket of some resources", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + "instruction": "CREATE_PROOF_FROM_BUCKET", + "into_proof": { + "identifier": { + "type": "String", + "value": "Proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "bucket", @@ -785,18 +1409,18 @@ ] }, "bucket": { - "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the Value model.", + "description": "The bucket of resources to create a proof from. This field is serialized as a `Bucket` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -804,6 +1428,25 @@ }, { "description": "An instruction to clone a proof creating a second proof identical to the original", + "examples": [ + { + "instruction": "CLONE_PROOF", + "into_proof": { + "identifier": { + "type": "String", + "value": "ident2" + }, + "type": "Proof" + }, + "proof": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -818,18 +1461,18 @@ ] }, "proof": { - "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the Value model.", + "description": "The original proof, or the proof to be cloned. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "into_proof": { - "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the Value model.", + "description": "The proof variable that the proof should go to. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -837,6 +1480,18 @@ }, { "description": "An instruction to drop a proof.", + "examples": [ + { + "instruction": "DROP_PROOF", + "proof": { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + } + } + ], "type": "object", "required": [ "instruction", @@ -850,10 +1505,10 @@ ] }, "proof": { - "description": "The proof to drop. This field is serialized as a `Proof` from the Value model.", + "description": "The proof to drop. This field is serialized as a `Proof` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -861,6 +1516,11 @@ }, { "description": "An instruction to drop all proofs currently present in the transaction context.", + "examples": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ], "type": "object", "required": [ "instruction" @@ -876,101 +1536,127 @@ }, { "description": "An instruction to publish a package and set it's associated royalty configs, metadata, and access rules.", - "type": "object", - "required": [ - "abi", - "access_rules", - "code", - "instruction", - "metadata", - "royalty_config" - ], - "properties": { - "instruction": { - "type": "string", - "enum": [ - "PUBLISH_PACKAGE" - ] - }, - "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "metadata": { - "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "access_rules": { - "description": "The access rules to use for the package. This is serialized as a `Tuple` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] + "examples": [ + { + "access_rules": { + "elements": [ + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "entries": [], + "key_value_kind": "Tuple", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Enum" + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "code": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + }, + "instruction": "PUBLISH_PACKAGE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + }, + "schema": { + "hash": "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b", + "type": "Blob" + } } - } - }, - { - "description": "An instruction to publish a package with an associated \"owner\" badge where all of the authority on the package is in the hands of said owner.", + ], "type": "object", "required": [ - "abi", + "access_rules", "code", "instruction", - "owner_badge" + "metadata", + "royalty_config", + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "PUBLISH_PACKAGE_WITH_OWNER" + "PUBLISH_PACKAGE" ] }, "code": { - "description": "The blob of the package code. This field is serialized as a `Blob` from the Value model.", + "description": "The blob of the package code. This field is serialized as a `Blob` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The blob of the package ABI. This field is serialized as a `Blob` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "abi": { - "description": "The blob of the package ABI. This field is serialized as a `Blob` from the Value model.", + "royalty_config": { + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "metadata": { + "description": "The metadata to use for the package. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this package. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the package. This is serialized as a `Tuple` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -978,6 +1664,18 @@ }, { "description": "An instruction to burn a bucket of tokens.", + "examples": [ + { + "bucket": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "BURN_RESOURCE" + } + ], "type": "object", "required": [ "bucket", @@ -994,7 +1692,7 @@ "description": "The bucket of tokens to burn.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1002,6 +1700,19 @@ }, { "description": "An instruction ot recall resources from a known vault.", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "RECALL_RESOURCE", + "vault_id": { + "type": "Bytes", + "value": "a9d55474c4fe9b04a5f39dc8164b9a9c22dae66a34e1417162c327912cc492" + } + } + ], "type": "object", "required": [ "amount", @@ -1019,15 +1730,15 @@ "description": "The id of the vault of the tokens to recall. This field is serialized as an `Own` from the value model and is expected to be an `Own::Vault`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the Value model.", + "description": "The amount of tokens to recall from the vault. This field is serialized as a `Decimal` field from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1035,6 +1746,41 @@ }, { "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METADATA", + "key": { + "type": "String", + "value": "name" + }, + "value": { + "fields": [ + { + "fields": [ + { + "type": "String", + "value": "deadbeef" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", @@ -1053,23 +1799,69 @@ "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the key to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "value": { - "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the Value model.", + "description": "A string of the value to set the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "An instruction to set the metadata on an entity.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "REMOVE_METADATA", + "key": { + "type": "String", + "value": "name" + } + } + ], + "type": "object", + "required": [ + "entity_address", + "instruction", + "key" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "REMOVE_METADATA" + ] + }, + "entity_address": { + "description": "The address of the entity to set metadata on. This is a discriminated union of types where it can either be a `ResourceAddress`, `ComponentAddress`, `PackageAddress` or a `ComponentAddress`.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "key": { + "description": "A string of the key to remove the metadata for. This field is serialized as a `String` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1077,6 +1869,21 @@ }, { "description": "An instruction to modify the royalties of a package.", + "examples": [ + { + "instruction": "SET_PACKAGE_ROYALTY_CONFIG", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + }, + "royalty_config": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "Tuple" + } + } + ], "type": "object", "required": [ "instruction", @@ -1091,18 +1898,18 @@ ] }, "package_address": { - "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the Value model.", + "description": "The address of the package to set the royalty on. This is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the Value model.", + "description": "The configurations of the royalty for the package. The underlying type of this is a Map where the key is a string of the blueprint name and the value is a `RoyaltyConfig`. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1110,6 +1917,30 @@ }, { "description": "An instruction to modify the royalties on a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_COMPONENT_ROYALTY_CONFIG", + "royalty_config": { + "elements": [ + { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "U32" + }, + { + "type": "U32", + "value": "1" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "component_address", @@ -1124,18 +1955,18 @@ ] }, "component_address": { - "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to modify royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "royalty_config": { - "description": "The royalty config to set on the component. This is an `Enum` from the `Value` model.", + "description": "The royalty config to set on the component. This is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1143,6 +1974,15 @@ }, { "description": "An instruction to claim royalties of a package", + "examples": [ + { + "instruction": "CLAIM_PACKAGE_ROYALTY", + "package_address": { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + } + ], "type": "object", "required": [ "instruction", @@ -1156,10 +1996,10 @@ ] }, "package_address": { - "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the Value model.", + "description": "The package address of the package to claim royalties for. This field is serialized as a `PackageAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1167,6 +2007,15 @@ }, { "description": "An instruction to claim royalties of a component", + "examples": [ + { + "component_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "CLAIM_COMPONENT_ROYALTY" + } + ], "type": "object", "required": [ "component_address", @@ -1180,10 +2029,10 @@ ] }, "component_address": { - "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the Value model.", + "description": "The component address of the component to claim royalties for. This field is serialized as a `ComponentAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1191,10 +2040,41 @@ }, { "description": "An instruction to modify the access rules of a method that an entity has.", + "examples": [ + { + "entity_address": { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + "instruction": "SET_METHOD_ACCESS_RULE", + "key": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "String", + "value": "free" + } + ], + "type": "Tuple" + }, + "rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "entity_address", - "index", "instruction", "key", "rule" @@ -1210,31 +2090,23 @@ "description": "The entity address of the entity to modify the access rules for.", "allOf": [ { - "$ref": "#/definitions/Value" - } - ] - }, - "index": { - "description": "Entity access rules is a stack of access rules, this index allows referring to a specific \"layer\" in said stack. This field is serialized as a `U32` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "key": { - "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the Value model", + "description": "The method key for the method to set the access rule of. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "rule": { - "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the Value model", + "description": "The new access rule to set in-place of the old one. This field is serialized as an `Enum` from the ManifestAstValue model", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1242,6 +2114,19 @@ }, { "description": "An instruction to mint fungible resources", + "examples": [ + { + "amount": { + "type": "Decimal", + "value": "1" + }, + "instruction": "MINT_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "amount", @@ -1256,18 +2141,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "amount": { - "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the Value model.", + "description": "The amount of fungible tokens to mint of this resource. This field is serialized as a `Decimal` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1275,6 +2160,21 @@ }, { "description": "An instruction to mint non-fungibles of a resource", + "examples": [ + { + "entries": { + "entries": [], + "key_value_kind": "NonFungibleLocalId", + "type": "Map", + "value_value_kind": "Tuple" + }, + "instruction": "MINT_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1289,18 +2189,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1308,6 +2208,47 @@ }, { "description": "An instruction to mint non-fungibles of a non-fungible resource that uses UUID as the type id and perform auto incrimination of ID.", + "examples": [ + { + "entries": { + "element_kind": "Tuple", + "elements": [ + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + }, + { + "elements": [ + { + "elements": [], + "type": "Tuple" + }, + { + "elements": [], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "Array" + }, + "instruction": "MINT_UUID_NON_FUNGIBLE", + "resource_address": { + "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", + "type": "Address" + } + } + ], "type": "object", "required": [ "entries", @@ -1322,18 +2263,18 @@ ] }, "resource_address": { - "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the Value model.", + "description": "The address of the resource to mint tokens of. This field is serialized as a `ResourceAddress` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "entries": { - "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "The non-fungible tokens to mint. The underlying type is a vector of tuples of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1341,11 +2282,31 @@ }, { "description": "An instruction to create a new fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ "access_rules", "divisibility", - "initial_supply", "instruction", "metadata" ], @@ -1357,85 +2318,102 @@ ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a fungible resource with initial supply", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "divisibility": { + "type": "U8", + "value": "18" + }, + "initial_supply": { + "type": "Decimal", + "value": "1" + }, + "instruction": "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + } + } + ], "type": "object", "required": [ + "access_rules", "divisibility", "initial_supply", "instruction", - "metadata", - "owner_badge" + "metadata" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "divisibility": { - "description": "The divisibility of the resource. This field is serialized as a `U8` from the Value model.", + "description": "The divisibility of the resource. This field is serialized as a `U8` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", + "description": "A decimal value of the initial supply to mint during resource creation. If present, this is serialized as a `Decimal` from the value model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1443,13 +2421,80 @@ }, { "description": "An instruction to create a new non-fungible resource.", + "examples": [ + { + "access_rules": { + "entries": [], + "key_value_kind": "Enum", + "type": "Map", + "value_value_kind": "Tuple" + }, + "id_type": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_NON_FUNGIBLE_RESOURCE", + "metadata": { + "entries": [], + "key_value_kind": "String", + "type": "Map", + "value_value_kind": "String" + }, + "schema": { + "elements": [ + { + "elements": [ + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Tuple", + "elements": [], + "type": "Array" + }, + { + "element_kind": "Enum", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + }, + { + "fields": [ + { + "type": "U8", + "value": "64" + } + ], + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "element_kind": "String", + "elements": [], + "type": "Array" + } + ], + "type": "Tuple" + } + } + ], "type": "object", "required": [ "access_rules", "id_type", - "initial_supply", "instruction", - "metadata" + "metadata", + "schema" ], "properties": { "instruction": { @@ -1459,85 +2504,94 @@ ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "access_rules": { - "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the Value model.", + "metadata": { + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } } }, { - "description": "An instruction to create a non-fungible resource with an associated \"owner\" badge where all of the authority on the resource is in the hands of said owner.", + "description": "An instruction to create a non-fungible resource with an initial supply", "type": "object", "required": [ + "access_rules", "id_type", "initial_supply", "instruction", "metadata", - "owner_badge" + "schema" ], "properties": { "instruction": { "type": "string", "enum": [ - "CREATE_NON_FUNGIBLE_RESOURCE_WITH_OWNER" + "CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY" ] }, "id_type": { - "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the Value model.", + "description": "The type of the non-fungible id to use for this resource. This field is serialized as an `Enum` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" + } + ] + }, + "schema": { + "description": "The schema that all non-fungibles of this resource must adhere to.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" } ] }, "metadata": { - "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the Value model.", + "description": "The metadata to set on the resource. The underlying type of this is a string-string Map of the metadata. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "owner_badge": { - "description": "The non-fungible address of the owner badge of this resource. This field is serialized as a `NonFungibleGlobalId` from the Value model.", + "access_rules": { + "description": "The access rules to use for the resource. The underlying type of this is a map which maps a `ResourceMethodAuthKey` enum to a tuple of two `AccessRule`s denoting the current behavior and the mutability. This is serialized as an `Map` from the ManifestAstValue model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "initial_supply": { - "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `Value` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", + "description": "An optional initial supply for the non-fungible resource being created. The underlying type of this is a map which maps a `NonFungibleLocalId` to a tuple of two `ManifestAstValue` elements where each element is a struct of the immutable and mutable parts of the non-fungible data.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1545,13 +2599,56 @@ }, { "description": "Creates a new access controller native component with the passed set of rules as the current active rule set and the specified timed recovery delay in minutes.", + "examples": [ + { + "controlled_asset": { + "identifier": { + "type": "String", + "value": "ident" + }, + "type": "Bucket" + }, + "instruction": "CREATE_ACCESS_CONTROLLER", + "rule_set": { + "elements": [ + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + ], + "type": "Tuple" + }, + "timed_recovery_delay_in_minutes": { + "type": "Some", + "value": { + "type": "U32", + "value": "1" + } + } + } + ], "type": "object", "required": [ - "confirmation_role", "controlled_asset", "instruction", - "primary_role", - "recovery_role", + "rule_set", "timed_recovery_delay_in_minutes" ], "properties": { @@ -1562,42 +2659,26 @@ ] }, "controlled_asset": { - "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "primary_role": { - "description": "The access rule to use for the primary role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/Value" - } - ] - }, - "recovery_role": { - "description": "The access rule to use for the recovery role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "description": "A bucket of the asset that will be controlled by the access controller. The underlying type of this is a `Bucket` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, - "confirmation_role": { - "description": "The access rule to use for the confirmation role of the access controller. The underlying type of this is an `Enum` from the `Value` model.", + "rule_set": { + "description": "The set of rules to use for the access controller's primary, confirmation, and recovery roles.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "timed_recovery_delay_in_minutes": { - "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `Value` model of an unsigned 32-bit integer of the time in minutes.", + "description": "The recovery delay in minutes to use for the access controller. The underlying type of this is an `Enum` or an `Option` from the `ManifestAstValue` model of an unsigned 32-bit integer of the time in minutes.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1605,8 +2686,20 @@ }, { "description": "Creates a new identity native component with the passed access rule.", - "type": "object", - "required": [ + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "CREATE_IDENTITY" + } + ], + "type": "object", + "required": [ "access_rule", "instruction" ], @@ -1618,10 +2711,10 @@ ] }, "access_rule": { - "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `Value` model.", + "description": "The access rule to protect the identity with. The underlying type of this is an `Enum` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1629,6 +2722,18 @@ }, { "description": "Assert that the given access rule is currently fulfilled by the proofs in the Auth Zone of the transaction", + "examples": [ + { + "access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + }, + "instruction": "ASSERT_ACCESS_RULE" + } + ], "type": "object", "required": [ "access_rule", @@ -1642,10 +2747,10 @@ ] }, "access_rule": { - "description": "The access rule to assert. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to assert. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1653,6 +2758,22 @@ }, { "description": "Creates a validator given the public key of the owner who controls it", + "examples": [ + { + "instruction": "CREATE_VALIDATOR", + "key": { + "type": "Bytes", + "value": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "owner_access_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], "type": "object", "required": [ "instruction", @@ -1667,18 +2788,54 @@ ] }, "key": { - "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `Value` model.", + "description": "The ECDSA Secp256k1 public key of the owner of the validator. The underlying type of this is an `EcdsaSecp256k1PublicKey` from the `ManifestAstValue` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] }, "owner_access_rule": { - "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `Value` model which represents the access rule to assert.", + "description": "The access rule to protect the validator with. The underlying type of this is an `Enum` from the `ManifestAstValue` model which represents the access rule to assert.", + "allOf": [ + { + "$ref": "#/definitions/ManifestAstValue" + } + ] + } + } + }, + { + "description": "Creates a new global account component which has the withdraw rule seen in the rule.", + "examples": [ + { + "instruction": "CREATE_ACCOUNT", + "withdraw_rule": { + "type": "Enum", + "variant": { + "discriminator": "0", + "type": "U8" + } + } + } + ], + "type": "object", + "required": [ + "instruction", + "withdraw_rule" + ], + "properties": { + "instruction": { + "type": "string", + "enum": [ + "CREATE_ACCOUNT" + ] + }, + "withdraw_rule": { + "description": "The withdraw rule to associate with the account.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ] } @@ -1686,11 +2843,27 @@ } ] }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "ManifestAstValue": { + "description": "A value model used to describe an algebraic sum type which is used to express transaction manifests as an abstract syntax tree. This is serialized as a discriminated union of types.", + "examples": [ + { + "type": "Bool", + "value": false + } + ], "oneOf": [ { "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -1710,6 +2883,12 @@ }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1730,6 +2909,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1750,6 +2935,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1770,6 +2961,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1790,6 +2987,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1810,6 +3013,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1830,6 +3039,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1850,6 +3065,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1870,6 +3091,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1890,6 +3117,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1910,6 +3143,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1929,6 +3168,48 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], "type": "object", "required": [ "type", @@ -1942,7 +3223,7 @@ ] }, "variant": { - "description": "The name of the variant of the enum", + "description": "The enum discriminator which is either a string or an unsigned 8-bit integer.", "allOf": [ { "$ref": "#/definitions/EnumDiscriminator" @@ -1956,13 +3237,22 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -1976,12 +3266,17 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], "type": "object", "required": [ "type" @@ -1996,7 +3291,16 @@ } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -2010,12 +3314,21 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], "type": "object", "required": [ "type", @@ -2029,12 +3342,32 @@ ] }, "value": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -2052,7 +3385,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2060,13 +3393,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -2085,7 +3447,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2093,7 +3455,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestAstValueKind" } ] }, @@ -2104,10 +3466,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } ], "maxItems": 2, @@ -2118,6 +3480,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -2133,13 +3515,19 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestAstValue" } } } }, { "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2160,6 +3548,12 @@ }, { "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2179,26 +3573,21 @@ } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ "address", @@ -2208,7 +3597,7 @@ "type": { "type": "string", "enum": [ - "ComponentAddress" + "Address" ] }, "address": { @@ -2217,45 +3606,107 @@ } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "ResourceAddress" + "Bucket" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/BucketId" } } }, { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } + ], "type": "object", "required": [ - "address", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "Proof" ] }, - "address": { - "type": "string" + "identifier": { + "$ref": "#/definitions/ProofId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ "type", @@ -2265,187 +3716,107 @@ "type": { "type": "string", "enum": [ - "Hash" + "NonFungibleLocalId" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } + ], "type": "object", "required": [ - "public_key", + "non_fungible_local_id", + "resource_address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1PublicKey" + "NonFungibleGlobalId" ] }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + "resource_address": { + "$ref": "#/definitions/ManifestAstValue" + }, + "non_fungible_local_id": { + "$ref": "#/definitions/ManifestAstValue" } } }, { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", "type": "object", "required": [ "type", @@ -2465,6 +3836,12 @@ }, { "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ "hash", @@ -2484,6 +3861,12 @@ }, { "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" + } + ], "type": "object", "required": [ "type", @@ -2505,6 +3888,16 @@ }, "EnumDiscriminator": { "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "examples": [ + { + "discriminator": "EnumName::Variant", + "type": "String" + }, + { + "discriminator": "1", + "type": "U8" + } + ], "oneOf": [ { "type": "object", @@ -2547,159 +3940,619 @@ } ] }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "ManifestAstValueKind": { "oneOf": [ { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "type": "string", + "enum": [ + "Bool" + ] + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "1", + "type": "U8" + } + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": { + "discriminator": "EnumName::Variant", + "type": "String" + } + } + ], + "type": "string", + "enum": [ + "Enum" + ] + }, + { + "description": "The `Some` case of Rust Options where the value is some Self", + "examples": [ + { + "type": "Some", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Some" + ] + }, + { + "description": "The `None` case of Rust Options where there is value", + "examples": [ + { + "type": "None" + } + ], + "type": "string", + "enum": [ + "None" + ] + }, + { + "description": "The `Ok` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Ok", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Ok" + ] + }, + { + "description": "The `Err` case of Rust Results where the value is some Self", + "examples": [ + { + "type": "Err", + "value": { + "type": "U8", + "value": "1" + } + } + ], + "type": "string", + "enum": [ + "Err" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "bucket" + }, + "type": "Bucket" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Bucket" } - } + ], + "type": "string", + "enum": [ + "Bucket" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": { + "type": "String", + "value": "proof" + }, + "type": "Proof" + }, + { + "identifier": { + "type": "U32", + "value": "1" + }, + "type": "Proof" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] + "type": "string", + "enum": [ + "Proof" + ] + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } } - } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + }, + { + "non_fungible_local_id": { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "Address" + }, + "type": "NonFungibleGlobalId" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] + "type": "string", + "enum": [ + "NonFungibleGlobalId" + ] + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" }, - "value": { - "type": "string" + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" } - } + ], + "type": "string", + "enum": [ + "Expression" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" + "type": "string", + "enum": [ + "Blob" + ] + }, + { + "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "examples": [ + { + "type": "Bytes", + "value": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e" } - } + ], + "type": "string", + "enum": [ + "Bytes" + ] } ] }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, "BucketId": { "description": "Represents a BucketId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2710,6 +4563,12 @@ "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", "oneOf": [ { + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2729,6 +4588,12 @@ } }, { + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2752,6 +4617,16 @@ }, "ProofId": { "description": "Represents a ProofId which uses a transient identifier.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + }, + { + "type": "U32", + "value": "1" + } + ], "allOf": [ { "$ref": "#/definitions/TransientIdentifier" @@ -2763,6 +4638,12 @@ "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -2783,6 +4664,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2803,6 +4690,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -2825,6 +4718,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -2863,6 +4762,75 @@ }, "DecompileSignedTransactionIntentResponse": { "description": "The response from [`DecompileSignedTransactionIntentRequest`].", + "examples": [ + { + "intent": { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "008db363f3dfda37dfc9e7d45eb72c2405939124b3b962df506fa9cca0017be0092e1341b79694228c4f53c80e790ef9258aafbf5051769a126ddf588016ad282f" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0174adbe3362c446ea2368ee1986864edc18f3eefc8b9ea0162756f04ffed310450a327cb3f8873070fc607844acec45b46490b4892fc4110c920ae28251b79100" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "01f55560f0fd9c1a90fca4a01c0e6cb613840ecd0a07fec7401e5e51b93f44df15586ec4a3d33a1811a6238e397e9964a1126ff32378dc5626c5126499ba3aac44" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "003fbca8a171f60a9a30a93fce9e846f130fee2a5989b7a93212877bf38f0afbb82ba7c9b718882bbf99a97f74fca1fe86ab4e6d85238873b29e851c193a48222e" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "0903d71eb96aa704338365d3ae15c0e8ca08d29aa1828a0439ecd0f0b64ba3fbee4f44c0bd694d08be51ebbb7d07c61961875894938b827627e5a77367b7320d" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "fce6e33719e6bf51f0ebe35cfe1ba26ce167063da7c7eaf48ecde64e3eb21bfcc2752c793c36a04493f52798bfcaaca66af70d889655067b1b5f3014f6cc7b0b" + }, + { + "curve": "EddsaEd25519", + "public_key": "fd50b8e3b144ea244fbf7737f550bc8dd0c2650bbc1aada833ca17ff8dbf329b", + "signature": "0a57400709fa697cc26268e959f29b1bc1d5fb6ed9b6a75381ca610cb9208f3a51ea72eced28e8e0636693a27e5019435827624e599aad30bfca4abbdae58b09" + }, + { + "curve": "EddsaEd25519", + "public_key": "fde4fba030ad002f7c2f7d4c331f49d13fb0ec747eceebec634f1ff4cbca9def", + "signature": "b3e149d3ce05f5e0e692e449095c8c0afbf0e51bd226ce087dd6f927c351240481440518695ed9521af29abac1e4fd59bf58ed251c0522dd55eda773d2b83504" + } + ] + } + ], "type": "object", "required": [ "intent", @@ -2888,6 +4856,31 @@ }, "TransactionIntent": { "description": "A transaction intent which is made of the header containing the transaction metadata and a manifest consisting of the instructions and blobs.", + "examples": [ + { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "String", + "value": "DROP_ALL_PROOFS;" + } + } + } + ], "type": "object", "required": [ "header", @@ -2917,6 +4910,12 @@ "oneOf": [ { "description": "Cryptographic signature and public key for Ecdsa Secp256k1", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" + } + ], "type": "object", "required": [ "curve", @@ -2940,6 +4939,13 @@ }, { "description": "Cryptographic signature and public key for EdDSA Ed25519", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", + "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" + } + ], "type": "object", "required": [ "curve", @@ -2973,6 +4979,81 @@ }, "DecompileNotarizedTransactionResponse": { "description": "The response from [`DecompileNotarizedTransactionRequest`].", + "examples": [ + { + "notary_signature": { + "curve": "EcdsaSecp256k1", + "signature": "017c36e8850679465e3beb4d8d945ec1875adb715cf62c2112025064b0a77a6ca818444970c69eafd2ed2ee1f50443498064aa477773a6dda5f49bfb84e2c4b834" + }, + "signed_intent": { + "intent": { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "008db363f3dfda37dfc9e7d45eb72c2405939124b3b962df506fa9cca0017be0092e1341b79694228c4f53c80e790ef9258aafbf5051769a126ddf588016ad282f" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0174adbe3362c446ea2368ee1986864edc18f3eefc8b9ea0162756f04ffed310450a327cb3f8873070fc607844acec45b46490b4892fc4110c920ae28251b79100" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "01f55560f0fd9c1a90fca4a01c0e6cb613840ecd0a07fec7401e5e51b93f44df15586ec4a3d33a1811a6238e397e9964a1126ff32378dc5626c5126499ba3aac44" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "003fbca8a171f60a9a30a93fce9e846f130fee2a5989b7a93212877bf38f0afbb82ba7c9b718882bbf99a97f74fca1fe86ab4e6d85238873b29e851c193a48222e" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "0903d71eb96aa704338365d3ae15c0e8ca08d29aa1828a0439ecd0f0b64ba3fbee4f44c0bd694d08be51ebbb7d07c61961875894938b827627e5a77367b7320d" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "fce6e33719e6bf51f0ebe35cfe1ba26ce167063da7c7eaf48ecde64e3eb21bfcc2752c793c36a04493f52798bfcaaca66af70d889655067b1b5f3014f6cc7b0b" + }, + { + "curve": "EddsaEd25519", + "public_key": "fd50b8e3b144ea244fbf7737f550bc8dd0c2650bbc1aada833ca17ff8dbf329b", + "signature": "0a57400709fa697cc26268e959f29b1bc1d5fb6ed9b6a75381ca610cb9208f3a51ea72eced28e8e0636693a27e5019435827624e599aad30bfca4abbdae58b09" + }, + { + "curve": "EddsaEd25519", + "public_key": "fde4fba030ad002f7c2f7d4c331f49d13fb0ec747eceebec634f1ff4cbca9def", + "signature": "b3e149d3ce05f5e0e692e449095c8c0afbf0e51bd226ce087dd6f927c351240481440518695ed9521af29abac1e4fd59bf58ed251c0522dd55eda773d2b83504" + } + ] + } + } + ], "type": "object", "required": [ "notary_signature", @@ -2999,6 +5080,75 @@ }, "SignedTransactionIntent": { "description": "A signed transaction intent which is made up of the intent as well as the intent signatures.", + "examples": [ + { + "intent": { + "header": { + "cost_unit_limit": "100000000", + "end_epoch_exclusive": "105", + "network_id": "1", + "nonce": "5144", + "notary_as_signatory": false, + "notary_public_key": { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + }, + "start_epoch_inclusive": "100", + "tip_percentage": "12", + "version": "1" + }, + "manifest": { + "blobs": [], + "instructions": { + "type": "Parsed", + "value": [ + { + "instruction": "DROP_ALL_PROOFS" + } + ] + } + } + }, + "intent_signatures": [ + { + "curve": "EcdsaSecp256k1", + "signature": "008db363f3dfda37dfc9e7d45eb72c2405939124b3b962df506fa9cca0017be0092e1341b79694228c4f53c80e790ef9258aafbf5051769a126ddf588016ad282f" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "0174adbe3362c446ea2368ee1986864edc18f3eefc8b9ea0162756f04ffed310450a327cb3f8873070fc607844acec45b46490b4892fc4110c920ae28251b79100" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "01f55560f0fd9c1a90fca4a01c0e6cb613840ecd0a07fec7401e5e51b93f44df15586ec4a3d33a1811a6238e397e9964a1126ff32378dc5626c5126499ba3aac44" + }, + { + "curve": "EcdsaSecp256k1", + "signature": "003fbca8a171f60a9a30a93fce9e846f130fee2a5989b7a93212877bf38f0afbb82ba7c9b718882bbf99a97f74fca1fe86ab4e6d85238873b29e851c193a48222e" + }, + { + "curve": "EddsaEd25519", + "public_key": "7422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe2674", + "signature": "0903d71eb96aa704338365d3ae15c0e8ca08d29aa1828a0439ecd0f0b64ba3fbee4f44c0bd694d08be51ebbb7d07c61961875894938b827627e5a77367b7320d" + }, + { + "curve": "EddsaEd25519", + "public_key": "f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b", + "signature": "fce6e33719e6bf51f0ebe35cfe1ba26ce167063da7c7eaf48ecde64e3eb21bfcc2752c793c36a04493f52798bfcaaca66af70d889655067b1b5f3014f6cc7b0b" + }, + { + "curve": "EddsaEd25519", + "public_key": "fd50b8e3b144ea244fbf7737f550bc8dd0c2650bbc1aada833ca17ff8dbf329b", + "signature": "0a57400709fa697cc26268e959f29b1bc1d5fb6ed9b6a75381ca610cb9208f3a51ea72eced28e8e0636693a27e5019435827624e599aad30bfca4abbdae58b09" + }, + { + "curve": "EddsaEd25519", + "public_key": "fde4fba030ad002f7c2f7d4c331f49d13fb0ec747eceebec634f1ff4cbca9def", + "signature": "b3e149d3ce05f5e0e692e449095c8c0afbf0e51bd226ce087dd6f927c351240481440518695ed9521af29abac1e4fd59bf58ed251c0522dd55eda773d2b83504" + } + ] + } + ], "type": "object", "required": [ "intent", @@ -3027,6 +5177,12 @@ "oneOf": [ { "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" + } + ], "type": "object", "required": [ "curve", @@ -3049,6 +5205,12 @@ }, { "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" + } + ], "type": "object", "required": [ "curve", diff --git a/schema/out/schema/derive_babylon_address_from_olympia_address_request.json b/schema/out/schema/derive_babylon_address_from_olympia_address_request.json new file mode 100644 index 00000000..b923998d --- /dev/null +++ b/schema/out/schema/derive_babylon_address_from_olympia_address_request.json @@ -0,0 +1,21 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DeriveBabylonAddressFromOlympiaAddressRequest", + "description": "Given an Olympia account address, this converts it from an Olympia account address to a Babylon ECDSA Secp256k1 virtual account address and reveals the underlying public key of the Olympia account.", + "type": "object", + "required": [ + "network_id", + "olympia_account_address" + ], + "properties": { + "network_id": { + "description": "An unsigned 8 bit integer serialized as a string which represents the ID of the network that the address will be used on. The primary use of this is for any Bech32m encoding or decoding of addresses", + "type": "string", + "pattern": "[0-9]+" + }, + "olympia_account_address": { + "description": "A string of the address on the Olympia network", + "type": "string" + } + } +} \ No newline at end of file diff --git a/schema/out/schema/derive_babylon_address_from_olympia_address_response.json b/schema/out/schema/derive_babylon_address_from_olympia_address_response.json new file mode 100644 index 00000000..2f836a5b --- /dev/null +++ b/schema/out/schema/derive_babylon_address_from_olympia_address_response.json @@ -0,0 +1,171 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "DeriveBabylonAddressFromOlympiaAddressResponse", + "description": "The response form [`DeriveBabylonAddressFromOlympiaAddressRequest`] requests", + "type": "object", + "required": [ + "babylon_account_address", + "public_key" + ], + "properties": { + "babylon_account_address": { + "description": "The Babylon account address associated with the Olympia address.", + "allOf": [ + { + "$ref": "#/definitions/EntityAddress" + } + ] + }, + "public_key": { + "description": "The public key associated with the Olympia account address.", + "allOf": [ + { + "$ref": "#/definitions/PublicKey" + } + ] + } + }, + "definitions": { + "EntityAddress": { + "description": "A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded string.", + "oneOf": [ + { + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "ComponentAddress" + } + ], + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ComponentAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "ResourceAddress" + } + ], + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ResourceAddress" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "PackageAddress" + } + ], + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PackageAddress" + ] + }, + "address": { + "type": "string" + } + } + } + ] + }, + "PublicKey": { + "description": "A discriminated union of the possible public keys used by Scrypto and the Radix Engine.", + "oneOf": [ + { + "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EcdsaSecp256k1" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + }, + { + "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], + "type": "object", + "required": [ + "curve", + "public_key" + ], + "properties": { + "curve": { + "type": "string", + "enum": [ + "EddsaEd25519" + ] + }, + "public_key": { + "type": "string", + "maxLength": 66, + "minLength": 66, + "pattern": "[0-9a-fA-F]+" + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/schema/out/schema/derive_non_fungible_global_id_from_public_key_request.json b/schema/out/schema/derive_non_fungible_global_id_from_public_key_request.json index dae59d5b..6f2e020c 100644 --- a/schema/out/schema/derive_non_fungible_global_id_from_public_key_request.json +++ b/schema/out/schema/derive_non_fungible_global_id_from_public_key_request.json @@ -27,6 +27,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -49,6 +55,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", diff --git a/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json b/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json index 98ea601a..e512505e 100644 --- a/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json +++ b/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json @@ -3,1898 +3,169 @@ "title": "DeriveNonFungibleGlobalIdFromPublicKeyResponse", "description": "The response from [`DeriveNonFungibleGlobalIdFromPublicKeyRequest`].", "type": "object", - "oneOf": [ - { - "description": "A boolean value which can either be true or false", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bool" - ] - }, - "value": { - "type": "boolean" - } - } - }, - { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A type representing a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", - "type": "object", - "required": [ - "type", - "variant" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Enum" - ] - }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Array" - ] - }, - "element_kind": { - "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", - "type": "object", - "required": [ - "entries", - "key_value_kind", - "type", - "value_value_kind" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Map" - ] - }, - "key_value_kind": { - "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "value_value_kind": { - "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "entries": { - "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/Value" - }, - { - "$ref": "#/definitions/Value" - } - ], - "maxItems": 2, - "minItems": 2 - } - } - } - }, - { - "description": "An array of elements where elements could be of different kinds.", - "type": "object", - "required": [ - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Tuple" - ] - }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Decimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PreciseDecimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] - }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PackageAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" - } - } - }, - { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" - } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" - } - } - } - ], - "definitions": { - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ - { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" - } - } - }, - { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", - "oneOf": [ - { - "description": "A boolean value which can either be true or false", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bool" - ] - }, - "value": { - "type": "boolean" - } - } - }, - { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A type representing a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", - "type": "object", - "required": [ - "type", - "variant" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Enum" - ] - }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Array" - ] - }, - "element_kind": { - "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", - "type": "object", - "required": [ - "entries", - "key_value_kind", - "type", - "value_value_kind" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Map" - ] - }, - "key_value_kind": { - "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "value_value_kind": { - "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "entries": { - "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/Value" - }, - { - "$ref": "#/definitions/Value" - } - ], - "maxItems": 2, - "minItems": 2 - } - } - } - }, - { - "description": "An array of elements where elements could be of different kinds.", - "type": "object", - "required": [ - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Tuple" - ] - }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Decimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PreciseDecimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] - }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PackageAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, + "required": [ + "non_fungible_global_id" + ], + "properties": { + "non_fungible_global_id": { + "description": "The non-fungible global id of the virtual badge associated with the given public key. The underlying type of this is a `NonFungibleGlobalId` from the `Value` model.", + "allOf": [ { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, + "$ref": "#/definitions/NonFungibleGlobalId" + } + ] + } + }, + "definitions": { + "NonFungibleGlobalId": { + "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "examples": [ { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } + "non_fungible_local_id": { + "type": "Integer", + "value": "1" + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "ResourceAddress" } }, { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } + "non_fungible_local_id": { + "type": "String", + "value": "Scrypto" + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "ResourceAddress" } }, { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" - ] - }, - "value": { - "$ref": "#/definitions/Expression" - } + "non_fungible_local_id": { + "type": "Bytes", + "value": "01020304" + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "ResourceAddress" } }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" - } + "non_fungible_local_id": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + }, + "resource_address": { + "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", + "type": "ResourceAddress" } + } + ], + "type": "object", + "required": [ + "non_fungible_local_id", + "resource_address" + ], + "properties": { + "resource_address": { + "$ref": "#/definitions/EntityAddress" }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" - } - } + "non_fungible_local_id": { + "$ref": "#/definitions/NonFungibleLocalId" } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] + } }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "EntityAddress": { + "description": "A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded string.", "oneOf": [ { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "ComponentAddress" } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", "type": "object", "required": [ - "type", - "value" + "address", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "Bucket" + "ComponentAddress" ] }, - "value": { + "address": { "type": "string" } } }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "ResourceAddress" } - } - } - ] - }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "TransientIdentifier": { - "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", - "oneOf": [ - { + ], "type": "object", "required": [ - "type", - "value" + "address", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "ResourceAddress" ] }, - "value": { - "description": "A string identifier", + "address": { "type": "string" } } }, { + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "PackageAddress" + } + ], "type": "object", "required": [ - "type", - "value" + "address", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "U32" + "PackageAddress" ] }, - "value": { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "string", - "pattern": "[0-9]+" + "address": { + "type": "string" } } } ] }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, "NonFungibleLocalId": { "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1915,6 +186,12 @@ }, { "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -1935,6 +212,12 @@ }, { "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -1957,6 +240,12 @@ }, { "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1977,21 +266,6 @@ } } ] - }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" - ] - }, - "Blob": { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" } } } \ No newline at end of file diff --git a/schema/out/schema/derive_virtual_account_address_request.json b/schema/out/schema/derive_virtual_account_address_request.json index 96256eb2..666a478f 100644 --- a/schema/out/schema/derive_virtual_account_address_request.json +++ b/schema/out/schema/derive_virtual_account_address_request.json @@ -28,6 +28,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -50,6 +56,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", diff --git a/schema/out/schema/derive_virtual_account_address_response.json b/schema/out/schema/derive_virtual_account_address_response.json index 3040b5af..8844da93 100644 --- a/schema/out/schema/derive_virtual_account_address_response.json +++ b/schema/out/schema/derive_virtual_account_address_response.json @@ -11,1186 +11,91 @@ "description": "The virtual account component address serialized as a `ComponentAddress` from the `Value` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] } }, "definitions": { - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "EntityAddress": { + "description": "A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded string.", "oneOf": [ { - "description": "A boolean value which can either be true or false", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bool" - ] - }, - "value": { - "type": "boolean" - } - } - }, - { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A type representing a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", - "type": "object", - "required": [ - "type", - "variant" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Enum" - ] - }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Array" - ] - }, - "element_kind": { - "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", - "type": "object", - "required": [ - "entries", - "key_value_kind", - "type", - "value_value_kind" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Map" - ] - }, - "key_value_kind": { - "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "value_value_kind": { - "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "entries": { - "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/Value" - }, - { - "$ref": "#/definitions/Value" - } - ], - "maxItems": 2, - "minItems": 2 - } - } - } - }, - { - "description": "An array of elements where elements could be of different kinds.", - "type": "object", - "required": [ - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Tuple" - ] - }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Decimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PreciseDecimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] - }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PackageAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "ComponentAddress" } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_local_id", - "resource_address", + "address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" + "ComponentAddress" ] }, - "value": { - "$ref": "#/definitions/Expression" + "address": { + "type": "string" } } }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "ResourceAddress" } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" - } - } - } - ] - }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ - { "type": "object", "required": [ - "discriminator", + "address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "ResourceAddress" ] }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", + "address": { "type": "string" } } }, { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "PackageAddress" } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ] - }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "TransientIdentifier": { - "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", - "oneOf": [ - { "type": "object", "required": [ - "type", - "value" + "address", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "PackageAddress" ] }, - "value": { - "description": "A string identifier", + "address": { "type": "string" } } - }, - { - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "NonFungibleLocalId": { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Integer" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "UUID" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "maxLength": 128, - "minLength": 2, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id. This can be between 1 and 64 characters long.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 1 - } - } } ] - }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" - ] - }, - "Blob": { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" } } } \ No newline at end of file diff --git a/schema/out/schema/derive_virtual_identity_address_request.json b/schema/out/schema/derive_virtual_identity_address_request.json index 707fee23..a97ed090 100644 --- a/schema/out/schema/derive_virtual_identity_address_request.json +++ b/schema/out/schema/derive_virtual_identity_address_request.json @@ -28,6 +28,12 @@ "oneOf": [ { "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", + "examples": [ + { + "curve": "EcdsaSecp256k1", + "public_key": "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798" + } + ], "type": "object", "required": [ "curve", @@ -50,6 +56,12 @@ }, { "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "examples": [ + { + "curve": "EddsaEd25519", + "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29" + } + ], "type": "object", "required": [ "curve", diff --git a/schema/out/schema/derive_virtual_identity_address_response.json b/schema/out/schema/derive_virtual_identity_address_response.json index 5bf5ead1..57fe3461 100644 --- a/schema/out/schema/derive_virtual_identity_address_response.json +++ b/schema/out/schema/derive_virtual_identity_address_response.json @@ -11,1186 +11,91 @@ "description": "The virtual identity component address serialized as a `ComponentAddress` from the `Value` model.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] } }, "definitions": { - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "EntityAddress": { + "description": "A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded string.", "oneOf": [ { - "description": "A boolean value which can either be true or false", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bool" - ] - }, - "value": { - "type": "boolean" - } - } - }, - { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A type representing a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", - "type": "object", - "required": [ - "type", - "variant" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Enum" - ] - }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Array" - ] - }, - "element_kind": { - "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", - "type": "object", - "required": [ - "entries", - "key_value_kind", - "type", - "value_value_kind" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Map" - ] - }, - "key_value_kind": { - "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "value_value_kind": { - "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "entries": { - "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/Value" - }, - { - "$ref": "#/definitions/Value" - } - ], - "maxItems": 2, - "minItems": 2 - } - } - } - }, - { - "description": "An array of elements where elements could be of different kinds.", - "type": "object", - "required": [ - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Tuple" - ] - }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Decimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PreciseDecimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] - }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PackageAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "ComponentAddress" } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_local_id", - "resource_address", + "address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" + "ComponentAddress" ] }, - "value": { - "$ref": "#/definitions/Expression" + "address": { + "type": "string" } } }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "ResourceAddress" } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" - } - } - } - ] - }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ - { "type": "object", "required": [ - "discriminator", + "address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "ResourceAddress" ] }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", + "address": { "type": "string" } } }, { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "PackageAddress" } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ] - }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "TransientIdentifier": { - "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", - "oneOf": [ - { "type": "object", "required": [ - "type", - "value" + "address", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "PackageAddress" ] }, - "value": { - "description": "A string identifier", + "address": { "type": "string" } } - }, - { - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "NonFungibleLocalId": { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Integer" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "UUID" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "maxLength": 128, - "minLength": 2, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id. This can be between 1 and 64 characters long.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 1 - } - } } ] - }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" - ] - }, - "Blob": { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" } } } \ No newline at end of file diff --git a/schema/out/schema/encode_address_response.json b/schema/out/schema/encode_address_response.json index cb815548..6eb84cc2 100644 --- a/schema/out/schema/encode_address_response.json +++ b/schema/out/schema/encode_address_response.json @@ -6,6 +6,12 @@ "oneOf": [ { "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "ComponentAddress" + } + ], "type": "object", "required": [ "address", @@ -25,6 +31,12 @@ }, { "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "ResourceAddress" + } + ], "type": "object", "required": [ "address", @@ -44,6 +56,12 @@ }, { "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "PackageAddress" + } + ], "type": "object", "required": [ "address", diff --git a/schema/out/schema/hash_request.json b/schema/out/schema/hash_request.json new file mode 100644 index 00000000..dc481645 --- /dev/null +++ b/schema/out/schema/hash_request.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HashRequest", + "description": "Hashes data using the hashing algorithm used in Scrypto and the Radix Engine", + "type": "object", + "required": [ + "payload" + ], + "properties": { + "payload": { + "description": "The payload to hash", + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } +} \ No newline at end of file diff --git a/schema/out/schema/hash_response.json b/schema/out/schema/hash_response.json new file mode 100644 index 00000000..7a22c0af --- /dev/null +++ b/schema/out/schema/hash_response.json @@ -0,0 +1,15 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "HashResponse", + "description": "The response of the [`HashRequest`]", + "type": "object", + "required": [ + "value" + ], + "properties": { + "value": { + "type": "string", + "pattern": "[0-9a-fA-F]+" + } + } +} \ No newline at end of file diff --git a/schema/out/schema/information_response.json b/schema/out/schema/information_response.json index 33011eb5..9332afda 100644 --- a/schema/out/schema/information_response.json +++ b/schema/out/schema/information_response.json @@ -4,7 +4,7 @@ "description": "The response from [`InformationRequest`]s", "type": "object", "required": [ - "git_hash", + "last_commit_hash", "package_version" ], "properties": { @@ -12,7 +12,7 @@ "description": "A SemVer string of the version of the Radix Engine Toolkit. Ideally, if the toolkit is version X then that means that it is compatible with version X of Scrypto.", "type": "string" }, - "git_hash": { + "last_commit_hash": { "description": "The hash of the commit that this build of the Radix Engine Toolkit was built against. This is useful when doing any form of debugging and trying to determine the version of the library", "type": "string" } diff --git a/schema/out/schema/known_entity_addresses_response.json b/schema/out/schema/known_entity_addresses_response.json index c7ea6a12..bcae73e3 100644 --- a/schema/out/schema/known_entity_addresses_response.json +++ b/schema/out/schema/known_entity_addresses_response.json @@ -20,7 +20,7 @@ "description": "A component address serialized as a `ComponentAddress` from the `Value` model which represents the address of the faucet component on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] }, @@ -28,7 +28,7 @@ "description": "A package address serialized as a `PackageAddress` from the `Value` model which represents the address of the faucet package on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] }, @@ -36,7 +36,7 @@ "description": "A package address serialized as a `PackageAddress` from the `Value` model which represents the address of the account package on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] }, @@ -44,7 +44,7 @@ "description": "A resource address serialized as a `ResourceAddress` from the `Value` model which represents the address of the XRD resource on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] }, @@ -52,7 +52,7 @@ "description": "A resource address serialized as a `ResourceAddress` from the `Value` model which represents the address of the system resource on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] }, @@ -60,7 +60,7 @@ "description": "A resource address serialized as a `ResourceAddress` from the `Value` model which represents the address of the Ecdsa Secp256k1 resource on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] }, @@ -68,7 +68,7 @@ "description": "A resource address serialized as a `ResourceAddress` from the `Value` model which represents the address of the EdDSA Ed25519 resource on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] }, @@ -76,7 +76,7 @@ "description": "A resource address serialized as a `ResourceAddress` from the `Value` model which represents the address of the package token resource on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] }, @@ -84,7 +84,7 @@ "description": "A system address serialized as a `ComponentAddress` from the `Value` model which represents the address of the epoch manager on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] }, @@ -92,1186 +92,91 @@ "description": "A system address serialized as a `ComponentAddress` from the `Value` model which represents the address of the clock on the requested network.", "allOf": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/EntityAddress" } ] } }, "definitions": { - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "EntityAddress": { + "description": "A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded string.", "oneOf": [ { - "description": "A boolean value which can either be true or false", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bool" - ] - }, - "value": { - "type": "boolean" - } - } - }, - { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I8" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I16" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I32" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I64" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A type representing a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string" - } - } - }, - { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", - "type": "object", - "required": [ - "type", - "variant" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Enum" - ] - }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Array" - ] - }, - "element_kind": { - "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", - "type": "object", - "required": [ - "entries", - "key_value_kind", - "type", - "value_value_kind" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Map" - ] - }, - "key_value_kind": { - "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "value_value_kind": { - "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", - "allOf": [ - { - "$ref": "#/definitions/ValueKind" - } - ] - }, - "entries": { - "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/Value" - }, - { - "$ref": "#/definitions/Value" - } - ], - "maxItems": 2, - "minItems": 2 - } - } - } - }, - { - "description": "An array of elements where elements could be of different kinds.", - "type": "object", - "required": [ - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Tuple" - ] - }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Decimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PreciseDecimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] - }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PackageAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "identifier": { - "$ref": "#/definitions/ProofId" + "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "ComponentAddress" } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NonFungibleLocalId" - ] - }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", "type": "object", "required": [ - "non_fungible_local_id", - "resource_address", + "address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "NonFungibleGlobalId" - ] - }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Expression" + "ComponentAddress" ] }, - "value": { - "$ref": "#/definitions/Expression" + "address": { + "type": "string" } } }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Blob" - ] - }, - "hash": { - "$ref": "#/definitions/Blob" + "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "ResourceAddress" } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" - } - } - } - ] - }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", - "oneOf": [ - { "type": "object", "required": [ - "discriminator", + "address", "type" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "ResourceAddress" ] }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", + "address": { "type": "string" } } }, { - "type": "object", - "required": [ - "discriminator", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" - ] - }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "oneOf": [ - { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" + "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "PackageAddress" } - } - }, - { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" - } - } - } - ] - }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "TransientIdentifier": { - "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", - "oneOf": [ - { "type": "object", "required": [ - "type", - "value" + "address", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "PackageAddress" ] }, - "value": { - "description": "A string identifier", + "address": { "type": "string" } } - }, - { - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "NonFungibleLocalId": { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Integer" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "UUID" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string", - "maxLength": 128, - "minLength": 2, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A string non-fungible id. This can be between 1 and 64 characters long.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 1 - } - } } ] - }, - "Expression": { - "description": "Represents a transaction manifest expression.", - "type": "string", - "enum": [ - "ENTIRE_WORKTOP", - "ENTIRE_AUTH_ZONE" - ] - }, - "Blob": { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" } } } \ No newline at end of file diff --git a/schema/out/schema/sbor_decode_response.json b/schema/out/schema/sbor_decode_response.json index 17b03bd4..5f50f07f 100644 --- a/schema/out/schema/sbor_decode_response.json +++ b/schema/out/schema/sbor_decode_response.json @@ -2,26 +2,60 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "SborDecodeResponse", "description": "The response from the [`SborDecodeRequest`].", - "type": "object", - "required": [ - "value" - ], - "properties": { - "value": { - "description": "A value representing the SBOR decoded form of the passed SBOR buffer.", - "allOf": [ - { - "$ref": "#/definitions/Value" + "oneOf": [ + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ScryptoSbor" + ] + }, + "value": { + "$ref": "#/definitions/ScryptoSborValue" } - ] + } + }, + { + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "ManifestSbor" + ] + }, + "value": { + "$ref": "#/definitions/ManifestSborValue" + } + } } - }, + ], "definitions": { - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "ScryptoSborValue": { + "description": "A value model used to describe an algebraic sum type which is used to express Scrypto SBOR values. This is serialized as a discriminated union of types.", "oneOf": [ { "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -41,6 +75,12 @@ }, { "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -61,6 +101,12 @@ }, { "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -81,6 +127,12 @@ }, { "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -101,6 +153,12 @@ }, { "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -121,6 +179,12 @@ }, { "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -141,6 +205,12 @@ }, { "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -161,6 +231,12 @@ }, { "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -181,6 +257,12 @@ }, { "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -201,6 +283,12 @@ }, { "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -221,6 +309,12 @@ }, { "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -241,6 +335,12 @@ }, { "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -260,6 +360,22 @@ }, { "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": "1" + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": "1" + } + ], "type": "object", "required": [ "type", @@ -273,12 +389,9 @@ ] }, "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] + "description": "The variant of the enum.", + "type": "string", + "pattern": "[0-9]+" }, "fields": { "description": "Optional fields that the enum may have", @@ -287,85 +400,33 @@ "null" ], "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ScryptoSborValue" } } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] - }, - "value": { - "$ref": "#/definitions/Value" + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", "type": "object", "required": [ "element_kind", @@ -383,7 +444,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ScryptoSborValueKind" } ] }, @@ -391,13 +452,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ScryptoSborValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -416,7 +506,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ScryptoSborValueKind" } ] }, @@ -424,7 +514,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ScryptoSborValueKind" } ] }, @@ -435,10 +525,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ScryptoSborValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ScryptoSborValue" } ], "maxItems": 2, @@ -449,6 +539,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -464,33 +574,83 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ScryptoSborValue" } } } }, { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + ], "type": "object", "required": [ - "type", - "value" + "address", + "type" ], "properties": { "type": { "type": "string", "enum": [ - "Decimal" + "Address" ] }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" + "address": { + "type": "string" } } }, { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "description": "Represents a tagged enum of owned Radix Engine Nodes.", + "examples": [ + { + "type": "Own", + "value": { + "type": "Bucket", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Proof", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Vault", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Object", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "KeyValueStore", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + } + ], "type": "object", "required": [ "type", @@ -500,17 +660,22 @@ "type": { "type": "string", "enum": [ - "PreciseDecimal" + "Own" ] }, "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" + "$ref": "#/definitions/Own" } } }, { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -520,73 +685,98 @@ "type": { "type": "string", "enum": [ - "Own" + "Decimal" ] }, "value": { - "$ref": "#/definitions/Own" + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" } } }, { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ - "address", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "ComponentAddress" + "PreciseDecimal" ] }, - "address": { - "type": "string" + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" } } }, { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } }, - "address": { - "type": "string" + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", + ], "type": "object", "required": [ - "address", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "PackageAddress" + "NonFungibleLocalId" ] }, - "address": { - "type": "string" + "value": { + "$ref": "#/definitions/NonFungibleLocalId" } } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", + "description": "Represents a reference to some RENode.", + "examples": [ + { + "type": "Reference", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + ], "type": "object", "required": [ "type", @@ -596,145 +786,515 @@ "type": { "type": "string", "enum": [ - "Hash" + "Reference" ] }, "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "$ref": "#/definitions/NodeIdentifier" } } - }, + } + ] + }, + "ScryptoSborValueKind": { + "oneOf": [ { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" + { + "type": "Bool", + "value": true } - } + ], + "type": "string", + "enum": [ + "Bool" + ] }, { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" } - } + ], + "type": "string", + "enum": [ + "U16" + ] }, { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": "1" + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": "1" + } + ], + "type": "string", + "enum": [ + "Enum" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + ], + "type": "string", + "enum": [ + "Address" + ] + }, + { + "description": "Represents a tagged enum of owned Radix Engine Nodes.", + "examples": [ + { + "type": "Own", + "value": { + "type": "Bucket", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Proof", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Vault", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Object", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "KeyValueStore", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + } + ], + "type": "string", + "enum": [ + "Own" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + { + "description": "Represents a reference to some RENode.", + "examples": [ + { + "type": "Reference", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + ], + "type": "string", + "enum": [ + "Reference" + ] + } + ] + }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "oneOf": [ + { + "description": "Represents an owned KeyValueStore", "type": "object", "required": [ - "public_key", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519PublicKey" + "KeyValueStore" ] }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "value": { + "$ref": "#/definitions/NodeIdentifier" } } }, { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", + "description": "Represents an owned Object", "type": "object", "required": [ - "signature", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "EddsaEd25519Signature" + "Object" ] }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" + "value": { + "$ref": "#/definitions/NodeIdentifier" } } }, { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "description": "Represents an owned Vault", "type": "object", "required": [ - "identifier", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "Bucket" + "Vault" ] }, - "identifier": { - "$ref": "#/definitions/BucketId" + "value": { + "$ref": "#/definitions/NodeIdentifier" } } }, { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "description": "Represents an owned Bucket", "type": "object", "required": [ - "identifier", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "Proof" + "Bucket" ] }, - "identifier": { - "$ref": "#/definitions/ProofId" + "value": { + "$ref": "#/definitions/NodeIdentifier" } } }, { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "description": "Represents an owned Proof", "type": "object", "required": [ "type", @@ -744,39 +1304,60 @@ "type": { "type": "string", "enum": [ - "NonFungibleLocalId" + "Proof" ] }, "value": { - "$ref": "#/definitions/NonFungibleLocalId" + "$ref": "#/definitions/NodeIdentifier" } } - }, + } + ] + }, + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 31 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 31, + "minLength": 31, + "pattern": "[0-9a-fA-F]+" + }, + "NonFungibleLocalId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "oneOf": [ { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ - "non_fungible_local_id", - "resource_address", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "NonFungibleGlobalId" + "Integer" ] }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Represents a transaction manifest expression.", + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -786,35 +1367,51 @@ "type": { "type": "string", "enum": [ - "Expression" + "UUID" ] }, "value": { - "$ref": "#/definitions/Expression" + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ - "hash", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "Blob" + "Bytes" ] }, - "hash": { - "$ref": "#/definitions/Blob" + "value": { + "type": "string", + "maxLength": 128, + "minLength": 2, + "pattern": "[0-9a-fA-F]+" } } }, { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -824,43 +1421,62 @@ "type": { "type": "string", "enum": [ - "Bytes" + "String" ] }, "value": { - "type": "string" + "type": "string", + "maxLength": 64, + "minLength": 1 } } } ] }, - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + "ManifestSborValue": { + "description": "A value model used to describe an algebraic sum type which is used to express Manifest SBOR values. This is serialized as a discriminated union of types.", "oneOf": [ { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ - "discriminator", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "Bool" ] }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" + "value": { + "type": "boolean" } } }, { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ - "discriminator", - "type" + "type", + "value" ], "properties": { "type": { @@ -869,64 +1485,20 @@ "U8" ] }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", + "value": { "type": "string", "pattern": "[0-9]+" } } - } - ] - }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "oneOf": [ + }, { - "description": "Represents an owned KeyValueStore", + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -936,16 +1508,23 @@ "type": { "type": "string", "enum": [ - "KeyValueStore" + "U16" ] }, "value": { - "$ref": "#/definitions/NodeIdentifier" + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Represents an owned Component", + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -955,16 +1534,23 @@ "type": { "type": "string", "enum": [ - "Component" + "U32" ] }, "value": { - "$ref": "#/definitions/NodeIdentifier" + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Represents an owned Vault", + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -974,16 +1560,23 @@ "type": { "type": "string", "enum": [ - "Vault" + "U64" ] }, "value": { - "$ref": "#/definitions/NodeIdentifier" + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -993,16 +1586,23 @@ "type": { "type": "string", "enum": [ - "Bucket" + "U128" ] }, "value": { - "type": "string" + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1012,35 +1612,23 @@ "type": { "type": "string", "enum": [ - "Proof" + "I8" ] }, "value": { - "type": "string" + "type": "string", + "pattern": "[0-9]+" } } - } - ] - }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "TransientIdentifier": { - "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", - "oneOf": [ + }, { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1050,16 +1638,23 @@ "type": { "type": "string", "enum": [ - "String" + "I16" ] }, "value": { - "description": "A string identifier", - "type": "string" + "type": "string", + "pattern": "[0-9]+" } } }, { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1069,31 +1664,23 @@ "type": { "type": "string", "enum": [ - "U32" + "I32" ] }, "value": { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", "type": "string", "pattern": "[0-9]+" } } - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "NonFungibleLocalId": { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "oneOf": [ + }, { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1103,7 +1690,7 @@ "type": { "type": "string", "enum": [ - "Integer" + "I64" ] }, "value": { @@ -1113,7 +1700,13 @@ } }, { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1123,7 +1716,7 @@ "type": { "type": "string", "enum": [ - "UUID" + "I128" ] }, "value": { @@ -1133,7 +1726,13 @@ } }, { - "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1143,37 +1742,891 @@ "type": { "type": "string", "enum": [ - "Bytes" + "String" ] }, "value": { - "type": "string", - "maxLength": 128, - "minLength": 2, - "pattern": "[0-9a-fA-F]+" + "type": "string" } } }, { - "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": "1" + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": "1" + } + ], "type": "object", "required": [ "type", - "value" + "variant" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "Enum" ] }, - "value": { + "variant": { + "description": "The variant of the enum.", "type": "string", - "maxLength": 64, - "minLength": 1 + "pattern": "[0-9]+" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/ManifestSborValue" + } + } + } + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ManifestSborValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/ManifestSborValue" + } + } + } + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ManifestSborValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ManifestSborValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/ManifestSborValue" + }, + { + "$ref": "#/definitions/ManifestSborValue" + } + ], + "maxItems": 2, + "minItems": 2 + } } } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/ManifestSborValue" + } + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + ], + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Address" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is a 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": "1", + "type": "Bucket" + } + ], + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bucket" + ] + }, + "identifier": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is a 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": "1", + "type": "Proof" + } + ], + "type": "object", + "required": [ + "identifier", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "identifier": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + "value": { + "$ref": "#/definitions/NonFungibleLocalId" + } + } + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Expression" + ] + }, + "value": { + "$ref": "#/definitions/Expression" + } + } + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], + "type": "object", + "required": [ + "hash", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Blob" + ] + }, + "hash": { + "$ref": "#/definitions/Blob" + } + } + } + ] + }, + "ManifestSborValueKind": { + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "string", + "enum": [ + "Bool" + ] + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": "1" + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": "1" + } + ], + "type": "string", + "enum": [ + "Enum" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "string", + "enum": [ + "Tuple" + ] + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + ], + "type": "string", + "enum": [ + "Address" + ] + }, + { + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is a 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": "1", + "type": "Bucket" + } + ], + "type": "string", + "enum": [ + "Bucket" + ] + }, + { + "description": "Represents a Scrypto proof which is identified through a transient identifier which is a 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": "1", + "type": "Proof" + } + ], + "type": "string", + "enum": [ + "Proof" + ] + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "Decimal" + ] + }, + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + { + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], + "type": "string", + "enum": [ + "Expression" + ] + }, + { + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], + "type": "string", + "enum": [ + "Blob" + ] } ] }, diff --git a/schema/out/schema/sbor_encode_request.json b/schema/out/schema/sbor_encode_request.json index 7095201c..3487fb00 100644 --- a/schema/out/schema/sbor_encode_request.json +++ b/schema/out/schema/sbor_encode_request.json @@ -2,10 +2,8 @@ "$schema": "http://json-schema.org/draft-07/schema#", "title": "SborEncodeRequest", "description": "This request takes in a [`Value`] and attempts to SBOR encode it and return back an SBOR byte array.", - "type": "object", "oneOf": [ { - "description": "A boolean value which can either be true or false", "type": "object", "required": [ "type", @@ -15,36 +13,15 @@ "type": { "type": "string", "enum": [ - "Bool" - ] - }, - "value": { - "type": "boolean" - } - } - }, - { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U8" + "ScryptoSbor" ] }, "value": { - "type": "string", - "pattern": "[0-9]+" + "$ref": "#/definitions/ScryptoSborValue" } } }, { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", "type": "object", "required": [ "type", @@ -54,819 +31,1307 @@ "type": { "type": "string", "enum": [ - "U16" + "ManifestSbor" ] }, "value": { - "type": "string", - "pattern": "[0-9]+" + "$ref": "#/definitions/ManifestSborValue" } } - }, - { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] + } + ], + "definitions": { + "ScryptoSborValue": { + "description": "A value model used to describe an algebraic sum type which is used to express Scrypto SBOR values. This is serialized as a discriminated union of types.", + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Bool" + ] + }, + "value": { + "type": "boolean" + } + } }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U64" - ] + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U128" - ] + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I8" - ] + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I16" - ] + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I32" - ] + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "U128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I64" - ] + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I8" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "I128" - ] + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I16" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } - }, - { - "description": "A type representing a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } }, - "value": { - "type": "string" - } - } - }, - { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", - "type": "object", - "required": [ - "type", - "variant" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Enum" - ] + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I64" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "I128" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" + } + } + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "String" + ] + }, + "value": { + "type": "string" + } + } + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": "1" + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": "1" + } + ], + "type": "object", + "required": [ + "type", + "variant" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Enum" + ] + }, + "variant": { + "description": "The variant of the enum.", + "type": "string", + "pattern": "[0-9]+" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/ScryptoSborValue" + } + } + } + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "object", + "required": [ + "element_kind", + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Array" + ] + }, + "element_kind": { + "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", + "allOf": [ + { + "$ref": "#/definitions/ScryptoSborValueKind" + } + ] + }, + "elements": { + "description": "The elements of the array which may contain 0 or more elements.", + "type": "array", + "items": { + "$ref": "#/definitions/ScryptoSborValue" + } + } + } + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "object", + "required": [ + "entries", + "key_value_kind", + "type", + "value_value_kind" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Map" + ] + }, + "key_value_kind": { + "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ScryptoSborValueKind" + } + ] + }, + "value_value_kind": { + "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", + "allOf": [ + { + "$ref": "#/definitions/ScryptoSborValueKind" + } + ] + }, + "entries": { + "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/ScryptoSborValue" + }, + { + "$ref": "#/definitions/ScryptoSborValue" + } + ], + "maxItems": 2, + "minItems": 2 + } + } + } + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], + "type": "object", + "required": [ + "elements", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Tuple" + ] + }, + "elements": { + "type": "array", + "items": { + "$ref": "#/definitions/ScryptoSborValue" + } + } + } + }, + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + ], + "type": "object", + "required": [ + "address", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Address" + ] + }, + "address": { + "type": "string" + } + } + }, + { + "description": "Represents a tagged enum of owned Radix Engine Nodes.", + "examples": [ + { + "type": "Own", + "value": { + "type": "Bucket", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Proof", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Vault", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Object", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "KeyValueStore", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Own" + ] + }, + "value": { + "$ref": "#/definitions/Own" + } + } + }, + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Decimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } + } }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ { - "$ref": "#/definitions/EnumDiscriminator" + "type": "PreciseDecimal", + "value": "1" } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" ], - "items": { - "$ref": "#/definitions/Value" + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "PreciseDecimal" + ] + }, + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" + } } - } - } - }, - { - "description": "The `Some` case of Rust Options where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Some" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `None` case of Rust Options where there is value", - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "None" - ] - } - } - }, - { - "description": "The `Ok` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Ok" - ] }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "The `Err` case of Rust Results where the value is some Value", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Err" - ] - }, - "value": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "An array values of a single value kind", - "type": "object", - "required": [ - "element_kind", - "elements", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Array" - ] - }, - "element_kind": { - "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", - "allOf": [ + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, { - "$ref": "#/definitions/ValueKind" + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } } - ] + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] + }, + "value": { + "$ref": "#/definitions/NonFungibleLocalId" + } + } }, - "elements": { - "description": "The elements of the array which may contain 0 or more elements.", - "type": "array", - "items": { - "$ref": "#/definitions/Value" + { + "description": "Represents a reference to some RENode.", + "examples": [ + { + "type": "Reference", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + ], + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Reference" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } } } - } + ] }, - { - "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", - "type": "object", - "required": [ - "entries", - "key_value_kind", - "type", - "value_value_kind" - ], - "properties": { - "type": { + "ScryptoSborValueKind": { + "oneOf": [ + { + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "string", "enum": [ - "Map" + "Bool" ] }, - "key_value_kind": { - "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", - "allOf": [ + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ { - "$ref": "#/definitions/ValueKind" + "type": "U8", + "value": "1" } + ], + "type": "string", + "enum": [ + "U8" ] }, - "value_value_kind": { - "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", - "allOf": [ + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ { - "$ref": "#/definitions/ValueKind" + "type": "U16", + "value": "1" } - ] - }, - "entries": { - "description": "A vector of tuples representing the entires in the map where each tuple is made up of two elements: a key and a value.", - "type": "array", - "items": { - "type": "array", - "items": [ - { - "$ref": "#/definitions/Value" - }, - { - "$ref": "#/definitions/Value" - } - ], - "maxItems": 2, - "minItems": 2 - } - } - } - }, - { - "description": "An array of elements where elements could be of different kinds.", - "type": "object", - "required": [ - "elements", - "type" - ], - "properties": { - "type": { + ], "type": "string", "enum": [ - "Tuple" + "U16" ] }, - "elements": { - "type": "array", - "items": { - "$ref": "#/definitions/Value" - } - } - } - }, - { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "string", "enum": [ - "Decimal" + "U32" ] }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "string", "enum": [ - "PreciseDecimal" + "U64" ] }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "string", "enum": [ - "Own" + "U128" ] }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "string", "enum": [ - "ComponentAddress" + "I8" ] }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "string", "enum": [ - "ResourceAddress" + "I16" ] }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "string", "enum": [ - "PackageAddress" + "I32" ] }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "string", "enum": [ - "Hash" + "I64" ] }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "string", "enum": [ - "EcdsaSecp256k1PublicKey" + "I128" ] }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "string", "enum": [ - "EcdsaSecp256k1Signature" + "String" ] }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": "1" + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": "1" + } + ], "type": "string", "enum": [ - "EddsaEd25519PublicKey" + "Enum" ] }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" - ], - "properties": { - "type": { + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "string", "enum": [ - "EddsaEd25519Signature" + "Array" ] }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "string", "enum": [ - "Bucket" + "Map" ] }, - "identifier": { - "$ref": "#/definitions/BucketId" - } - } - }, - { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", - "type": "object", - "required": [ - "identifier", - "type" - ], - "properties": { - "type": { + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "string", "enum": [ - "Proof" + "Tuple" ] }, - "identifier": { - "$ref": "#/definitions/ProofId" - } - } - }, - { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { + { + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" + }, + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" + } + ], "type": "string", "enum": [ - "NonFungibleLocalId" + "Address" ] }, - "value": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", - "type": "object", - "required": [ - "non_fungible_local_id", - "resource_address", - "type" - ], - "properties": { - "type": { + { + "description": "Represents a tagged enum of owned Radix Engine Nodes.", + "examples": [ + { + "type": "Own", + "value": { + "type": "Bucket", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Proof", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Vault", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "Object", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + }, + { + "type": "Own", + "value": { + "type": "KeyValueStore", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + } + ], "type": "string", "enum": [ - "NonFungibleGlobalId" + "Own" ] }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" - } - } - }, - { - "description": "Represents a transaction manifest expression.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { + { + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "string", "enum": [ - "Expression" + "Decimal" ] }, - "value": { - "$ref": "#/definitions/Expression" - } - } - }, - { - "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", - "type": "object", - "required": [ - "hash", - "type" - ], - "properties": { - "type": { + { + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "string", "enum": [ - "Blob" + "PreciseDecimal" ] }, - "hash": { - "$ref": "#/definitions/Blob" - } - } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { + { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "string", "enum": [ - "Bytes" + "NonFungibleLocalId" ] }, - "value": { - "type": "string" + { + "description": "Represents a reference to some RENode.", + "examples": [ + { + "type": "Reference", + "value": "00000000000000000000000000000000000000000000000000000000000000" + } + ], + "type": "string", + "enum": [ + "Reference" + ] } - } - } - ], - "definitions": { - "EnumDiscriminator": { - "description": "A union of the types of discriminators that enums may have. This may either be a string or an 8-bit unsigned number.", + ] + }, + "Own": { + "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", "oneOf": [ { + "description": "Represents an owned KeyValueStore", "type": "object", "required": [ - "discriminator", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "String" + "KeyValueStore" ] }, - "discriminator": { - "description": "A string discriminator of the fully qualified well-known enum name", - "type": "string" + "value": { + "$ref": "#/definitions/NodeIdentifier" } } }, { + "description": "Represents an owned Object", "type": "object", "required": [ - "discriminator", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "U8" + "Object" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Vault", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Vault" ] }, - "discriminator": { - "description": "An 8-bit unsigned integer serialized as a string.", + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Bucket", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { "type": "string", - "pattern": "[0-9]+" + "enum": [ + "Bucket" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" + } + } + }, + { + "description": "Represents an owned Proof", + "type": "object", + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Proof" + ] + }, + "value": { + "$ref": "#/definitions/NodeIdentifier" } } } ] }, - "Value": { - "description": "The Value model used to describe all of the types that the Radix Engine Toolkit accepts and returns.", + "NodeIdentifier": { + "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 31 (since hex encoding doubles the number of bytes needed.)", + "type": "string", + "maxLength": 31, + "minLength": 31, + "pattern": "[0-9a-fA-F]+" + }, + "NonFungibleLocalId": { + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", "oneOf": [ { - "description": "A boolean value which can either be true or false", + "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "Integer", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -876,16 +1341,23 @@ "type": { "type": "string", "enum": [ - "Bool" + "Integer" ] }, "value": { - "type": "boolean" + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -895,7 +1367,7 @@ "type": { "type": "string", "enum": [ - "U8" + "UUID" ] }, "value": { @@ -905,7 +1377,13 @@ } }, { - "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", + "examples": [ + { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + ], "type": "object", "required": [ "type", @@ -915,17 +1393,25 @@ "type": { "type": "string", "enum": [ - "U16" + "Bytes" ] }, "value": { "type": "string", - "pattern": "[0-9]+" + "maxLength": 128, + "minLength": 2, + "pattern": "[0-9a-fA-F]+" } } }, { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "description": "A string non-fungible id. This can be between 1 and 64 characters long.", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -935,17 +1421,33 @@ "type": { "type": "string", "enum": [ - "U32" + "String" ] }, "value": { "type": "string", - "pattern": "[0-9]+" + "maxLength": 64, + "minLength": 1 } } - }, + } + ] + }, + "ManifestSborValue": { + "description": "A value model used to describe an algebraic sum type which is used to express Manifest SBOR values. This is serialized as a discriminated union of types.", + "oneOf": [ { - "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } + ], "type": "object", "required": [ "type", @@ -955,17 +1457,22 @@ "type": { "type": "string", "enum": [ - "U64" + "Bool" ] }, "value": { - "type": "string", - "pattern": "[0-9]+" + "type": "boolean" } } }, { - "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -975,7 +1482,7 @@ "type": { "type": "string", "enum": [ - "U128" + "U8" ] }, "value": { @@ -985,7 +1492,13 @@ } }, { - "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -995,7 +1508,7 @@ "type": { "type": "string", "enum": [ - "I8" + "U16" ] }, "value": { @@ -1005,7 +1518,13 @@ } }, { - "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1015,7 +1534,7 @@ "type": { "type": "string", "enum": [ - "I16" + "U32" ] }, "value": { @@ -1025,7 +1544,13 @@ } }, { - "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1035,7 +1560,7 @@ "type": { "type": "string", "enum": [ - "I32" + "U64" ] }, "value": { @@ -1045,7 +1570,13 @@ } }, { - "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1055,7 +1586,7 @@ "type": { "type": "string", "enum": [ - "I64" + "U128" ] }, "value": { @@ -1065,7 +1596,13 @@ } }, { - "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1075,7 +1612,7 @@ "type": { "type": "string", "enum": [ - "I128" + "I8" ] }, "value": { @@ -1085,7 +1622,13 @@ } }, { - "description": "A type representing a string", + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1095,50 +1638,49 @@ "type": { "type": "string", "enum": [ - "String" + "I16" ] }, "value": { - "type": "string" + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], "type": "object", "required": [ "type", - "variant" + "value" ], "properties": { "type": { "type": "string", "enum": [ - "Enum" - ] - }, - "variant": { - "description": "The name of the variant of the enum", - "allOf": [ - { - "$ref": "#/definitions/EnumDiscriminator" - } - ] - }, - "fields": { - "description": "Optional fields that the enum may have", - "type": [ - "array", - "null" - ], - "items": { - "$ref": "#/definitions/Value" - } + "I32" + ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "The `Some` case of Rust Options where the value is some Value", + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1148,31 +1690,49 @@ "type": { "type": "string", "enum": [ - "Some" + "I64" ] }, "value": { - "$ref": "#/definitions/Value" + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "The `None` case of Rust Options where there is value", + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], "type": "object", "required": [ - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "None" + "I128" ] + }, + "value": { + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "The `Ok` case of Rust Results where the value is some Value", + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], "type": "object", "required": [ "type", @@ -1182,35 +1742,83 @@ "type": { "type": "string", "enum": [ - "Ok" + "String" ] }, "value": { - "$ref": "#/definitions/Value" + "type": "string" } } }, { - "description": "The `Err` case of Rust Results where the value is some Value", + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": "1" + }, + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": "1" + } + ], "type": "object", "required": [ "type", - "value" + "variant" ], "properties": { "type": { "type": "string", "enum": [ - "Err" + "Enum" ] }, - "value": { - "$ref": "#/definitions/Value" + "variant": { + "description": "The variant of the enum.", + "type": "string", + "pattern": "[0-9]+" + }, + "fields": { + "description": "Optional fields that the enum may have", + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/ManifestSborValue" + } } } }, { "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], "type": "object", "required": [ "element_kind", @@ -1228,7 +1836,7 @@ "description": "The kind of elements that the array contains. An array will be validated to ensure that it contains a single element kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestSborValueKind" } ] }, @@ -1236,13 +1844,42 @@ "description": "The elements of the array which may contain 0 or more elements.", "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestSborValue" } } } }, { "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], "type": "object", "required": [ "entries", @@ -1261,7 +1898,7 @@ "description": "The kind of the keys used for the map. A map will be validated to ensure that its keys are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestSborValueKind" } ] }, @@ -1269,7 +1906,7 @@ "description": "The kind of the values used for the map. A map will be validated to ensure that its values are all of a single kind.", "allOf": [ { - "$ref": "#/definitions/ValueKind" + "$ref": "#/definitions/ManifestSborValueKind" } ] }, @@ -1280,10 +1917,10 @@ "type": "array", "items": [ { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestSborValue" }, { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestSborValue" } ], "maxItems": 2, @@ -1294,6 +1931,26 @@ }, { "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" + } + ], "type": "object", "required": [ "elements", @@ -1309,110 +1966,27 @@ "elements": { "type": "array", "items": { - "$ref": "#/definitions/Value" + "$ref": "#/definitions/ManifestSborValue" } } } }, { - "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Decimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "PreciseDecimal" - ] - }, - "value": { - "type": "string", - "pattern": "[+-]?([0-9]*[.])?[0-9]+" - } - } - }, - { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Own" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/Own" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable component address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ComponentAddress" - ] + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" }, - "address": { - "type": "string" + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } - }, - { - "description": "Represents a Bech32m encoded human-readable resource address. This address is serialized as a human-readable bech32m encoded string.", - "type": "object", - "required": [ - "address", - "type" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "ResourceAddress" - ] - }, - "address": { - "type": "string" - } - } - }, - { - "description": "Represents a Bech32m encoded human-readable package address. This address is serialized as a human-readable bech32m encoded string.", "type": "object", "required": [ "address", @@ -1422,7 +1996,7 @@ "type": { "type": "string", "enum": [ - "PackageAddress" + "Address" ] }, "address": { @@ -1431,117 +2005,39 @@ } }, { - "description": "Represents a hash coming from Scrypto's and the Radix Engine's common hash function. The hashing function that they use is SHA256 which produces 32 byte long hashes which are serialized as a 64 character long hex string (since hex encoding doubles the Integer of bytes needed)", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Hash" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is a 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": "1", + "type": "Bucket" } - } - }, - { - "description": "A byte array of 33 bytes which are serialized as a 66 character long hex-encoded string representing a public key from the ECDSA Secp256k1 elliptic curve.", - "type": "object", - "required": [ - "public_key", - "type" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EcdsaSecp256k1PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "A byte array of 65 bytes which are serialized as a 130 character long hex-encoded string representing a signature from the ECDSA Secp256k1 elliptic curve. An important note on ECDSA Secp256k1 signatures is that the format used and accepted by Scrypto is [v, r, s] where `v` is the recovery id and is a single byte and `r` and `s` are the signature results and are 32 bytes each.", "type": "object", "required": [ - "signature", + "identifier", "type" ], "properties": { "type": { "type": "string", "enum": [ - "EcdsaSecp256k1Signature" + "Bucket" ] }, - "signature": { + "identifier": { "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" + "pattern": "[0-9]+" } } }, { - "description": "A byte array of 32 bytes which are serialized as a 64 character long hex-encoded string representing a public key from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "public_key", - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519PublicKey" - ] - }, - "public_key": { - "type": "string", - "maxLength": 64, - "minLength": 64, - "pattern": "[0-9a-fA-F]+" + "description": "Represents a Scrypto proof which is identified through a transient identifier which is a 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": "1", + "type": "Proof" } - } - }, - { - "description": "A byte array of 64 bytes which are serialized as a 128 character long hex-encoded string representing a signature from the EDDSA Ed25519 edwards curve.", - "type": "object", - "required": [ - "signature", - "type" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "EddsaEd25519Signature" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Represents a Scrypto bucket which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", "type": "object", "required": [ "identifier", @@ -1551,35 +2047,49 @@ "type": { "type": "string", "enum": [ - "Bucket" + "Proof" ] }, "identifier": { - "$ref": "#/definitions/BucketId" + "type": "string", + "pattern": "[0-9]+" } } }, { - "description": "Represents a Scrypto proof which is identified through a transient identifier which is either a string or an unsigned 32-bit integer which is serialized as a Integer.", + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" + } + ], "type": "object", - "required": [ - "identifier", - "type" + "required": [ + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "Proof" + "Decimal" ] }, - "identifier": { - "$ref": "#/definitions/ProofId" + "value": { + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" } } }, { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" + } + ], "type": "object", "required": [ "type", @@ -1589,39 +2099,76 @@ "type": { "type": "string", "enum": [ - "NonFungibleLocalId" + "PreciseDecimal" ] }, "value": { - "$ref": "#/definitions/NonFungibleLocalId" + "type": "string", + "pattern": "[+-]?([0-9]*[.])?[0-9]+" } } }, { - "description": "Represents a non-fungible address which may be considered as the \"global\" address of a non-fungible unit as it contains both the resource address and the non-fungible id for that unit.", + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } + } + ], "type": "object", "required": [ - "non_fungible_local_id", - "resource_address", - "type" + "type", + "value" ], "properties": { "type": { "type": "string", "enum": [ - "NonFungibleGlobalId" + "NonFungibleLocalId" ] }, - "resource_address": { - "$ref": "#/definitions/Value" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/Value" + "value": { + "$ref": "#/definitions/NonFungibleLocalId" } } }, { "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" + }, + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" + } + ], "type": "object", "required": [ "type", @@ -1641,6 +2188,12 @@ }, { "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" + } + ], "type": "object", "required": [ "hash", @@ -1657,324 +2210,423 @@ "$ref": "#/definitions/Blob" } } - }, - { - "description": "Represents a byte array of an unknown size which is serialized as a hex string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] - }, - "value": { - "type": "string" - } - } } ] }, - "ValueKind": { - "description": "An Enum of all of the supported kinds of values by the Radix Engine Toolkit. This enum is essentially the `type` tags used for the value model.", - "type": "string", - "enum": [ - "Bool", - "U8", - "U16", - "U32", - "U64", - "U128", - "I8", - "I16", - "I32", - "I64", - "I128", - "String", - "Enum", - "Some", - "None", - "Ok", - "Err", - "Map", - "Array", - "Tuple", - "Decimal", - "PreciseDecimal", - "Own", - "ComponentAddress", - "ResourceAddress", - "PackageAddress", - "Hash", - "EcdsaSecp256k1PublicKey", - "EcdsaSecp256k1Signature", - "EddsaEd25519PublicKey", - "EddsaEd25519Signature", - "Bucket", - "Proof", - "NonFungibleLocalId", - "NonFungibleGlobalId", - "Expression", - "Blob", - "Bytes" - ] - }, - "Own": { - "description": "Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the transaction manifest.", + "ManifestSborValueKind": { "oneOf": [ { - "description": "Represents an owned KeyValueStore", - "type": "object", - "required": [ - "type", - "value" + "description": "A boolean value which can either be true or false", + "examples": [ + { + "type": "Bool", + "value": false + }, + { + "type": "Bool", + "value": true + } ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] + "type": "string", + "enum": [ + "Bool" + ] + }, + { + "description": "An 8-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U8" + ] + }, + { + "description": "A 16-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U16" + ] + }, + { + "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U32" + ] + }, + { + "description": "A 64-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U64" + ] + }, + { + "description": "A 128-bit unsigned integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "U128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "U128" + ] + }, + { + "description": "An 8-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I8", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I8" + ] + }, + { + "description": "A 16-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I16", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I16" + ] + }, + { + "description": "A 32-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I32", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I32" + ] + }, + { + "description": "A 64-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I64", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I64" + ] + }, + { + "description": "A 128-bit signed integer which is serialized and deserialized as a string.", + "examples": [ + { + "type": "I128", + "value": "1" + } + ], + "type": "string", + "enum": [ + "I128" + ] + }, + { + "description": "A type representing a string", + "examples": [ + { + "type": "String", + "value": "Scrypto" + } + ], + "type": "string", + "enum": [ + "String" + ] + }, + { + "description": "A Rust-style Enum which has a variant and can optionally also have a list of values (acting in a way similar to discriminated algebraic sum types)", + "examples": [ + { + "type": "Enum", + "variant": "1" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "fields": [ + { + "type": "U8", + "value": "1" + } + ], + "type": "Enum", + "variant": "1" + } + ], + "type": "string", + "enum": [ + "Enum" + ] + }, + { + "description": "An array values of a single value kind", + "examples": [ + { + "element_kind": "U8", + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "U8", + "value": "2" + }, + { + "type": "U8", + "value": "3" + } + ], + "type": "Array" + } + ], + "type": "string", + "enum": [ + "Array" + ] + }, + { + "description": "A key-value map of values where all keys are of a single kind and all values are of a single kind", + "examples": [ + { + "entries": [ + [ + { + "type": "U8", + "value": "65" + }, + { + "type": "String", + "value": "A" + } + ], + [ + { + "type": "U8", + "value": "66" + }, + { + "type": "String", + "value": "B" + } + ] + ], + "key_value_kind": "U8", + "type": "Map", + "value_value_kind": "String" + } + ], + "type": "string", + "enum": [ + "Map" + ] + }, + { + "description": "An array of elements where elements could be of different kinds.", + "examples": [ + { + "elements": [ + { + "elements": [ + { + "type": "U8", + "value": "1" + }, + { + "type": "String", + "value": "Something" + } + ], + "type": "Tuple" + } + ], + "type": "Tuple" } - } + ], + "type": "string", + "enum": [ + "Tuple" + ] }, { - "description": "Represents an owned Component", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Component" - ] + "description": "Represents a Bech32m encoded human-readable address which may be used to address a package, component, or resource. This address is serialized as a human-readable bech32m encoded string.", + "examples": [ + { + "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve", + "type": "Address" }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + { + "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf", + "type": "Address" + }, + { + "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4", + "type": "Address" } - } + ], + "type": "string", + "enum": [ + "Address" + ] }, { - "description": "Represents an owned Vault", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Vault" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" + "description": "Represents a Scrypto bucket which is identified through a transient identifier which is a 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": "1", + "type": "Bucket" } - } + ], + "type": "string", + "enum": [ + "Bucket" + ] }, { - "description": "Represents an owned Bucket identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bucket" - ] - }, - "value": { - "type": "string" + "description": "Represents a Scrypto proof which is identified through a transient identifier which is a 32-bit integer which is serialized as a Integer.", + "examples": [ + { + "identifier": "1", + "type": "Proof" } - } + ], + "type": "string", + "enum": [ + "Proof" + ] }, { - "description": "Represents an owned Proof identified through an unsigned 32-bit integer which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Proof" - ] - }, - "value": { - "type": "string" + "description": "A Scrypto Decimal which has a precision of 18 decimal places and has a maximum and minimum of 57896044618658097711785492504343953926634992332820282019728.792003956564819967 and -57896044618658097711785492504343953926634992332820282019728.792003956564819968 respectively", + "examples": [ + { + "type": "Decimal", + "value": "1" } - } - } - ] - }, - "NodeIdentifier": { - "description": "Represents a Radix Engine persistent node identifier which is 36 bytes long and serialized as a hexadecimal string of length 72 (since hex encoding doubles the number of bytes needed.)", - "type": "string", - "maxLength": 72, - "minLength": 72, - "pattern": "[0-9a-fA-F]+" - }, - "BucketId": { - "description": "Represents a BucketId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "TransientIdentifier": { - "description": "Represents a tagged transient identifier typically used as an identifiers for Scrypto buckets and proofs. Could either be a string or an unsigned 32-bit number (which is serialized as a number and not a string)", - "oneOf": [ - { - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "description": "A string identifier", - "type": "string" - } - } + "type": "string", + "enum": [ + "Decimal" + ] }, { - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "U32" - ] - }, - "value": { - "description": "A 32-bit unsigned integer which is serialized and deserialized as a string.", - "type": "string", - "pattern": "[0-9]+" + "description": "A Scrypto PreciseDecimal which has a precision of 64 decimal places and has a maximum and minimum of 670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714. 9083451713845015929093243025426876941405973284973216824503042047 and -670390396497129854978701249910292306373968291029619668886178072186088201503677348840093714.9083451713845015929093243025426876941405973284973216824503042048 respectively", + "examples": [ + { + "type": "PreciseDecimal", + "value": "1" } - } - } - ] - }, - "ProofId": { - "description": "Represents a ProofId which uses a transient identifier.", - "allOf": [ - { - "$ref": "#/definitions/TransientIdentifier" - } - ] - }, - "NonFungibleLocalId": { - "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", - "oneOf": [ - { - "description": "A 64 bit unsigned integer non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Integer" - ] - }, - "value": { - "type": "string", - "pattern": "[0-9]+" - } - } + "type": "string", + "enum": [ + "PreciseDecimal" + ] }, { - "description": "A 128 bit unsigned integer UUID non-fungible id type which is serialized as a string", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "UUID" - ] + "description": "Represents non-fungible ids which is a discriminated union of the different types that non-fungible ids may be.", + "examples": [ + { + "type": "NonFungibleLocalId", + "value": { + "type": "UUID", + "value": "241008287272164729465721528295504357972" + } }, - "value": { - "type": "string", - "pattern": "[0-9]+" + { + "type": "NonFungibleLocalId", + "value": { + "type": "Integer", + "value": "1" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "String", + "value": "Scrypto" + } + }, + { + "type": "NonFungibleLocalId", + "value": { + "type": "Bytes", + "value": "01020304" + } } - } + ], + "type": "string", + "enum": [ + "NonFungibleLocalId" + ] }, { - "description": "An byte array non-fungible id type which is serialized as a hex string. This can be between 1 and 64 bytes in length which translates to a length range of 2 and 128 when hex-encoded.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Bytes" - ] + "description": "Represents a transaction manifest expression.", + "examples": [ + { + "type": "Expression", + "value": "ENTIRE_AUTH_ZONE" }, - "value": { - "type": "string", - "maxLength": 128, - "minLength": 2, - "pattern": "[0-9a-fA-F]+" + { + "type": "Expression", + "value": "ENTIRE_WORKTOP" } - } + ], + "type": "string", + "enum": [ + "Expression" + ] }, { - "description": "A string non-fungible id. This can be between 1 and 64 characters long.", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "String" - ] - }, - "value": { - "type": "string", - "maxLength": 64, - "minLength": 1 + "description": "Represents the hash of a blob provided as part of a transaction manifest. This is represented as a byte array of 32 bytes which is serialized as a hex string.", + "examples": [ + { + "hash": "d28d2c3710601fbc097000ec73455693f4861dc0eb7c90d8821f2a13f617313e", + "type": "Blob" } - } + ], + "type": "string", + "enum": [ + "Blob" + ] } ] }, diff --git a/schema/src/examples.rs b/schema/src/examples.rs index 779ea430..f4f486cf 100644 --- a/schema/src/examples.rs +++ b/schema/src/examples.rs @@ -16,14 +16,23 @@ // under the License. use native_transaction::builder::TransactionBuilder; +use native_transaction::ecdsa_secp256k1::EcdsaSecp256k1PrivateKey; +use native_transaction::eddsa_ed25519::EddsaEd25519PrivateKey; use native_transaction::manifest::compile; use native_transaction::model::{NotarizedTransaction, TransactionHeader}; -use native_transaction::signing::{EcdsaSecp256k1PrivateKey, EddsaEd25519PrivateKey}; -use radix_engine_toolkit::*; +use scrypto::network::NetworkDefinition; +use scrypto::prelude::manifest_encode; -use scrypto::{prelude::*, radix_engine_interface::node::NetworkDefinition}; +use radix_engine_toolkit::model::address::Bech32Coder; +use radix_engine_toolkit::model::transaction::InstructionKind; +use radix_engine_toolkit::model::value::scrypto_sbor::{ScryptoSborValue, ScryptoSborValueKind}; + +use radix_engine_toolkit::request::traits::Handler; +use scrypto::prelude::*; use serde::Serialize; +use radix_engine_toolkit::request::*; + pub fn network_definition() -> NetworkDefinition { NetworkDefinition::simulator() } @@ -65,41 +74,41 @@ pub fn notary_private_key() -> EcdsaSecp256k1PrivateKey { EcdsaSecp256k1PrivateKey::from_u64(1923112).unwrap() } -pub fn value() -> Value { - Value::Tuple { +pub fn value() -> ScryptoSborValue { + ScryptoSborValue::Tuple { elements: vec![ - Value::Decimal { value: dec!("10") }, - Value::PreciseDecimal { value: pdec!("10") }, - Value::String { + ScryptoSborValue::Decimal { value: dec!("10") }, + ScryptoSborValue::PreciseDecimal { value: pdec!("10") }, + ScryptoSborValue::String { value: "Hello World!".into(), }, - Value::Tuple { + ScryptoSborValue::Tuple { elements: vec![ - Value::Decimal { value: dec!("10") }, - Value::PreciseDecimal { value: pdec!("10") }, - Value::String { + ScryptoSborValue::Decimal { value: dec!("10") }, + ScryptoSborValue::PreciseDecimal { value: pdec!("10") }, + ScryptoSborValue::String { value: "Hello World!".into(), }, - Value::Tuple { + ScryptoSborValue::Tuple { elements: vec![ - Value::Decimal { value: dec!("10") }, - Value::PreciseDecimal { value: pdec!("10") }, - Value::String { + ScryptoSborValue::Decimal { value: dec!("10") }, + ScryptoSborValue::PreciseDecimal { value: pdec!("10") }, + ScryptoSborValue::String { value: "Hello World!".into(), }, - Value::Tuple { + ScryptoSborValue::Tuple { elements: vec![ - Value::Decimal { value: dec!("10") }, - Value::PreciseDecimal { value: pdec!("10") }, - Value::String { + ScryptoSborValue::Decimal { value: dec!("10") }, + ScryptoSborValue::PreciseDecimal { value: pdec!("10") }, + ScryptoSborValue::String { value: "Hello World!".into(), }, - Value::Array { - element_kind: ValueKind::Decimal, + ScryptoSborValue::Array { + element_kind: ScryptoSborValueKind::Decimal, elements: vec![ - Value::Decimal { value: dec!("20") }, - Value::Decimal { value: dec!("100") }, - Value::Decimal { + ScryptoSborValue::Decimal { value: dec!("20") }, + ScryptoSborValue::Decimal { value: dec!("100") }, + ScryptoSborValue::Decimal { value: dec!("192.31"), }, ], @@ -118,6 +127,7 @@ pub struct Example { pub request_type_name: String, pub response_type_name: String, pub request_description: String, + pub required_features: String, pub request: String, pub response: String, } @@ -125,15 +135,16 @@ pub struct Example { pub trait ExampleData where Self: Handler, - I: Serialize + Clone, - O: Serialize + Clone, + I: Serialize + Clone + Debug, + O: Serialize + Clone + Debug, { fn description() -> String; fn example_request() -> I; fn example_response() -> O { - Self::fulfill(Self::example_request()).unwrap() + Self::fulfill(Self::example_request()) + .expect(format!("Failed. Request: {:?}", Self::example_request()).as_str()) } fn request_type_name() -> String { @@ -151,6 +162,10 @@ where .to_owned() } + fn required_features() -> String { + "default".into() + } + fn to_example() -> Example { let request = Self::example_request(); let response = Self::example_response(); @@ -158,6 +173,7 @@ where request_type_name: Self::request_type_name(), response_type_name: Self::response_type_name(), request_description: Self::description(), + required_features: Self::required_features(), request: serde_json::to_string_pretty(&request).unwrap(), response: serde_json::to_string_pretty(&response).unwrap(), } @@ -175,7 +191,8 @@ impl ExampleData for InformationHandler fn example_response() -> InformationResponse { let mut response = Self::fulfill(Self::example_request()).unwrap(); - response.git_hash = "This is just an example. We don't have a commit hash here :)".into(); + response.last_commit_hash = + "This is just an example. We don't have a commit hash here".into(); response } } @@ -192,13 +209,15 @@ This function allows the client the convert their manifest between the two suppo fn example_request() -> ConvertManifestRequest { let bec32_coder = Bech32Coder::new(network_definition().id); ConvertManifestRequest { - manifest: radix_engine_toolkit::TransactionManifest::from_native_manifest( - ¬arized_intent().signed_intent.intent.manifest, - InstructionKind::Parsed, - &bec32_coder, - ) - .unwrap(), - instructions_output_kind: radix_engine_toolkit::model::InstructionKind::Parsed, + manifest: + radix_engine_toolkit::model::transaction::TransactionManifest::from_native_manifest( + ¬arized_intent().signed_intent.intent.manifest, + InstructionKind::Parsed, + &bec32_coder, + ) + .unwrap(), + instructions_output_kind: + radix_engine_toolkit::model::transaction::InstructionKind::Parsed, network_id: network_definition().id, } } @@ -212,12 +231,13 @@ impl ExampleData for AnalyzeMan fn example_request() -> AnalyzeManifestRequest { let bec32_coder = Bech32Coder::new(network_definition().id); AnalyzeManifestRequest { - manifest: radix_engine_toolkit::TransactionManifest::from_native_manifest( - ¬arized_intent().signed_intent.intent.manifest, - InstructionKind::String, - &bec32_coder, - ) - .unwrap(), + manifest: + radix_engine_toolkit::model::transaction::TransactionManifest::from_native_manifest( + ¬arized_intent().signed_intent.intent.manifest, + InstructionKind::String, + &bec32_coder, + ) + .unwrap(), network_id: network_definition().id, } } @@ -233,8 +253,8 @@ impl ExampleData CompileTransactionIntentRequest { CompileTransactionIntentRequest { transaction_intent: - radix_engine_toolkit::TransactionIntent::from_native_transaction_intent( - ¬arized_intent().signed_intent.intent.clone(), + radix_engine_toolkit::model::transaction::TransactionIntent::from_native_transaction_intent( + ¬arized_intent().signed_intent.intent, InstructionKind::Parsed, ) .unwrap(), @@ -251,10 +271,11 @@ impl ExampleData DecompileTransactionIntentRequest { let compiled_transaction_intent = - scrypto_encode(¬arized_intent().signed_intent.intent).unwrap(); + manifest_encode(¬arized_intent().signed_intent.intent).unwrap(); DecompileTransactionIntentRequest { compiled_intent: compiled_transaction_intent, - instructions_output_kind: radix_engine_toolkit::model::InstructionKind::Parsed, + instructions_output_kind: + radix_engine_toolkit::model::transaction::InstructionKind::Parsed, } } } @@ -268,9 +289,9 @@ impl ExampleData CompileSignedTransactionIntentRequest { CompileSignedTransactionIntentRequest { - signed_intent: radix_engine_toolkit::SignedTransactionIntent::from_native_signed_transaction_intent(¬arized_intent() + signed_intent: radix_engine_toolkit::model::transaction::SignedTransactionIntent::from_native_signed_transaction_intent(¬arized_intent() .signed_intent - .clone(), InstructionKind::Parsed) + , InstructionKind::Parsed) .unwrap(), } } @@ -285,10 +306,11 @@ impl ExampleData DecompileSignedTransactionIntentRequest { let compiled_transaction_intent = - scrypto_encode(¬arized_intent().signed_intent).unwrap(); + manifest_encode(¬arized_intent().signed_intent).unwrap(); DecompileSignedTransactionIntentRequest { compiled_signed_intent: compiled_transaction_intent, - instructions_output_kind: radix_engine_toolkit::model::InstructionKind::Parsed, + instructions_output_kind: + radix_engine_toolkit::model::transaction::InstructionKind::Parsed, } } } @@ -302,8 +324,8 @@ impl ExampleData CompileNotarizedTransactionRequest { CompileNotarizedTransactionRequest { - notarized_intent: radix_engine_toolkit::NotarizedTransaction::from_native_notarized_transaction_intent(¬arized_intent() - .clone(), InstructionKind::Parsed) + notarized_intent: radix_engine_toolkit::model::transaction::NotarizedTransaction::from_native_notarized_transaction_intent(¬arized_intent() + , InstructionKind::Parsed) .unwrap(), } } @@ -317,10 +339,11 @@ impl ExampleData DecompileNotarizedTransactionRequest { - let compiled_transaction_intent = scrypto_encode(¬arized_intent()).unwrap(); + let compiled_transaction_intent = manifest_encode(¬arized_intent()).unwrap(); DecompileNotarizedTransactionRequest { compiled_notarized_intent: compiled_transaction_intent, - instructions_output_kind: radix_engine_toolkit::model::InstructionKind::Parsed, + instructions_output_kind: + radix_engine_toolkit::model::transaction::InstructionKind::Parsed, } } } @@ -334,10 +357,11 @@ impl } fn example_request() -> DecompileUnknownTransactionIntentRequest { - let compiled_transaction_intent = scrypto_encode(¬arized_intent()).unwrap(); + let compiled_transaction_intent = manifest_encode(¬arized_intent()).unwrap(); DecompileUnknownTransactionIntentRequest { compiled_unknown_intent: compiled_transaction_intent, - instructions_output_kind: radix_engine_toolkit::model::InstructionKind::Parsed, + instructions_output_kind: + radix_engine_toolkit::model::transaction::InstructionKind::Parsed, } } } @@ -364,31 +388,51 @@ impl ExampleData for DecodeAddressH fn example_request() -> DecodeAddressRequest { DecodeAddressRequest { - address: "resource_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqd60rqz".into(), + address: "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k".into(), } } } impl ExampleData for SborEncodeHandler { fn description() -> String { - r#"This function takes in a Value and encodes it in SBOR."#.to_owned() + r#"This function takes in a ScryptoSborValue and encodes it in SBOR."#.to_owned() } fn example_request() -> SborEncodeRequest { - SborEncodeRequest { - value: value().clone(), - } + SborEncodeRequest::ScryptoSbor(value()) } } impl ExampleData for SborDecodeHandler { fn description() -> String { - r#"This function takes in a hex string and attemps to decode it into a Value."#.to_owned() + r#"This function takes in a hex string and attempts to decode it into a ScryptoSborValue."# + .to_owned() } fn example_request() -> SborDecodeRequest { SborDecodeRequest { - encoded_value: (value()).encode().unwrap(), + encoded_value: vec![ + 77, // prefix + 33, // struct + 10, // field length + 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, // address + 128, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, // address + 128, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, // address + 129, 4, 0, 0, 0, // bucket + 130, 5, 0, 0, 0, // proof + 131, 1, // expression + 132, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, // blob + 133, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, // decimal + 134, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, // precise decimal + 135, 0, 3, 97, 98, 99, // non-fungible local id + ], network_id: 0xf2, } } @@ -445,6 +489,26 @@ impl } } +impl + ExampleData< + DeriveBabylonAddressFromOlympiaAddressRequest, + DeriveBabylonAddressFromOlympiaAddressResponse, + > for DeriveBabylonAddressFromOlympiaAddressHandler +{ + fn description() -> String { + r#"Derives the Babylon account address associated with the given Olympia account address"# + .to_owned() + } + + fn example_request() -> DeriveBabylonAddressFromOlympiaAddressRequest { + DeriveBabylonAddressFromOlympiaAddressRequest { + network_id: 0x01, + olympia_account_address: + "rdx1qspx7zxmnrh36q33av24srdfzg7m3cj65968erpjuh7ja3rm3kmn6hq4j9842".to_owned(), + } + } +} + impl ExampleData for KnownEntityAddressesHandler { @@ -470,13 +534,13 @@ impl ExampleData StaticallyValidateTransactionRequest { // Making the notarized transaction invalid let notarized_transaction = { - let mut transaction = notarized_intent().clone(); + let mut transaction = notarized_intent(); transaction.notary_signature = transaction.signed_intent.intent_signatures[0].signature(); transaction }; - let compiled_transaction_intent = scrypto_encode(¬arized_transaction).unwrap(); + let compiled_transaction_intent = manifest_encode(¬arized_transaction).unwrap(); let validation_config = native_transaction::validation::ValidationConfig::default(0xf2); StaticallyValidateTransactionRequest { compiled_notarized_intent: compiled_transaction_intent, @@ -484,3 +548,25 @@ impl ExampleData for HashHandler { + fn description() -> String { + r#"Hashes some payload through the hashing algorithm used in Scrypto and the Radix Engine."# + .to_owned() + } + + fn example_request() -> HashRequest { + // Making the notarized transaction invalid + let notarized_transaction = { + let mut transaction = notarized_intent(); + transaction.notary_signature = + transaction.signed_intent.intent_signatures[0].signature(); + transaction + }; + + let compiled_transaction_intent = manifest_encode(¬arized_transaction).unwrap(); + HashRequest { + payload: compiled_transaction_intent, + } + } +} diff --git a/schema/src/examples_builder.rs b/schema/src/examples_builder.rs index fe3f70c3..7f9407db 100644 --- a/schema/src/examples_builder.rs +++ b/schema/src/examples_builder.rs @@ -15,6 +15,8 @@ // specific language governing permissions and limitations // under the License. +use std::fmt::Debug; + use convert_case::{Case, Casing}; use serde::Serialize; @@ -34,8 +36,8 @@ impl InMemoryExamplesBuilder { pub fn add_example(mut self) -> Self where H: ExampleData, - I: Serialize + Clone, - O: Serialize + Clone, + I: Serialize + Clone + Debug, + O: Serialize + Clone + Debug, { let example = H::to_example(); self.examples.push(example); @@ -60,7 +62,8 @@ impl InMemoryExamplesBuilder { | Function Name | `{}` | | ----------------- | :----------------- | | JNI Function Name | `{}` | -| Functionality | {} | +| Functionality | {} | +| Required Features | {} | | Request Type | `{}` | | Response Type | `{}` | @@ -84,6 +87,7 @@ impl InMemoryExamplesBuilder { function_name, jni_function_name, example.request_description.replace('\n', "
"), + example.required_features, example.request_type_name, example.response_type_name, example.request, diff --git a/schema/src/main.rs b/schema/src/main.rs index ffdf8226..0abef2a5 100644 --- a/schema/src/main.rs +++ b/schema/src/main.rs @@ -23,6 +23,7 @@ use std::path::PathBuf; use convert_case::Casing; use examples_builder::InMemoryExamplesBuilder; + use radix_engine_toolkit::request::*; /// Generates a Schema HashMap where the key is the class name and the value is the schema @@ -56,46 +57,52 @@ pub fn generate_json_schema() -> Result<(), GenerationError> { // Creating the schema for all of the request and response types through the generate schema // macro let schema_map = generate_schema_hashmap!( - radix_engine_toolkit::request::InformationRequest, - radix_engine_toolkit::request::InformationResponse, - radix_engine_toolkit::request::ConvertManifestRequest, - radix_engine_toolkit::request::ConvertManifestResponse, - radix_engine_toolkit::request::AnalyzeManifestRequest, - radix_engine_toolkit::request::AnalyzeManifestResponse, - radix_engine_toolkit::request::CompileTransactionIntentRequest, - radix_engine_toolkit::request::CompileTransactionIntentResponse, - radix_engine_toolkit::request::DecompileTransactionIntentRequest, - radix_engine_toolkit::request::DecompileTransactionIntentResponse, - radix_engine_toolkit::request::CompileSignedTransactionIntentRequest, - radix_engine_toolkit::request::CompileSignedTransactionIntentResponse, - radix_engine_toolkit::request::DecompileSignedTransactionIntentRequest, - radix_engine_toolkit::request::DecompileSignedTransactionIntentResponse, - radix_engine_toolkit::request::CompileNotarizedTransactionRequest, - radix_engine_toolkit::request::CompileNotarizedTransactionResponse, - radix_engine_toolkit::request::DecompileNotarizedTransactionRequest, - radix_engine_toolkit::request::DecompileNotarizedTransactionResponse, - radix_engine_toolkit::request::DecompileUnknownTransactionIntentRequest, - radix_engine_toolkit::request::DecompileUnknownTransactionIntentResponse, - radix_engine_toolkit::request::DecodeAddressRequest, - radix_engine_toolkit::request::DecodeAddressResponse, - radix_engine_toolkit::request::EncodeAddressRequest, - radix_engine_toolkit::request::EncodeAddressResponse, - radix_engine_toolkit::request::DecodeAddressRequest, - radix_engine_toolkit::request::DecodeAddressResponse, - radix_engine_toolkit::request::SborEncodeRequest, - radix_engine_toolkit::request::SborEncodeResponse, - radix_engine_toolkit::request::SborDecodeRequest, - radix_engine_toolkit::request::SborDecodeResponse, - radix_engine_toolkit::request::DeriveVirtualAccountAddressRequest, - radix_engine_toolkit::request::DeriveVirtualAccountAddressResponse, - radix_engine_toolkit::request::DeriveVirtualIdentityAddressRequest, - radix_engine_toolkit::request::DeriveVirtualIdentityAddressResponse, - radix_engine_toolkit::request::DeriveNonFungibleGlobalIdFromPublicKeyRequest, - radix_engine_toolkit::request::DeriveNonFungibleGlobalIdFromPublicKeyResponse, - radix_engine_toolkit::request::KnownEntityAddressesRequest, - radix_engine_toolkit::request::KnownEntityAddressesResponse, - radix_engine_toolkit::request::StaticallyValidateTransactionRequest, - radix_engine_toolkit::request::StaticallyValidateTransactionResponse + InformationRequest, + InformationResponse, + ConvertManifestRequest, + ConvertManifestResponse, + AnalyzeManifestRequest, + AnalyzeManifestResponse, + AnalyzeManifestWithPreviewContextRequest, + AnalyzeManifestWithPreviewContextResponse, + CompileTransactionIntentRequest, + CompileTransactionIntentResponse, + DecompileTransactionIntentRequest, + DecompileTransactionIntentResponse, + CompileSignedTransactionIntentRequest, + CompileSignedTransactionIntentResponse, + DecompileSignedTransactionIntentRequest, + DecompileSignedTransactionIntentResponse, + CompileNotarizedTransactionRequest, + CompileNotarizedTransactionResponse, + DecompileNotarizedTransactionRequest, + DecompileNotarizedTransactionResponse, + DecompileUnknownTransactionIntentRequest, + DecompileUnknownTransactionIntentResponse, + DecodeAddressRequest, + DecodeAddressResponse, + EncodeAddressRequest, + EncodeAddressResponse, + DecodeAddressRequest, + DecodeAddressResponse, + SborEncodeRequest, + SborEncodeResponse, + SborDecodeRequest, + SborDecodeResponse, + DeriveVirtualAccountAddressRequest, + DeriveVirtualAccountAddressResponse, + DeriveVirtualIdentityAddressRequest, + DeriveVirtualIdentityAddressResponse, + DeriveBabylonAddressFromOlympiaAddressRequest, + DeriveBabylonAddressFromOlympiaAddressResponse, + DeriveNonFungibleGlobalIdFromPublicKeyRequest, + DeriveNonFungibleGlobalIdFromPublicKeyResponse, + KnownEntityAddressesRequest, + KnownEntityAddressesResponse, + StaticallyValidateTransactionRequest, + StaticallyValidateTransactionResponse, + HashRequest, + HashResponse ); // Iterating over the HashMap, modifying the class name to be in snake case and writing the @@ -130,24 +137,27 @@ pub fn generate_json_schema() -> Result<(), GenerationError> { fn generate_request_examples() -> Result<(), GenerationError> { let examples = InMemoryExamplesBuilder::new() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() - .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() + .add_example::() .build(); let path = { diff --git a/serializable/Cargo.toml b/toolkit-derive/Cargo.toml similarity index 79% rename from serializable/Cargo.toml rename to toolkit-derive/Cargo.toml index d216fbba..17544199 100644 --- a/serializable/Cargo.toml +++ b/toolkit-derive/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "serializable" -version = "0.8.0" +name = "toolkit-derive" +version = "0.9.0" edition = "2021" [dependencies] diff --git a/serializable/src/lib.rs b/toolkit-derive/src/lib.rs similarity index 100% rename from serializable/src/lib.rs rename to toolkit-derive/src/lib.rs