diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 031c05f3..00000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,53 +0,0 @@ -# Problem Being Solved - -This section describes the problem that this pull request aims to solve without making any mention of how the problem is solved or any implementation details. In other words, when filling up this section, you may want to answer the following questions: - -* "Why are you making this pull request?" -* "What parts of the current behavior are undesirable and why do you wish to change them?" -* "What features are missing and why do you wish to add them? Who are the primary user-group that this feature targets?" - -An example of what to include in this section is: - -> Currently, when a mutex is locked, it is only unlocked _if_ the operation that it is being locked for succeeds. Otherwise, the mutex lock is not dropped. While this does not pose any immediate issues right now, it could begin to pose problems in the future if we try to recover from `Result::Err`s in code. -> -> [Here](https://www.github.com/radixdlt/radix-engine-toolkit) is an example of the part of the code that has the issue. As can be seen in the block of code below, the question mark operator is used on the `Result` returned from the `validate_and_modify_data` function which means that if the return is `Result::Ok` then the execution of the block of code continues and the lock is dropped; however, if it is `Result::Err` then the execution of the block is not continued, the error is bubbled up, and the mutex lock is not dropped. -> ```rust -> let lock_handle = mutex.lock(Lock::ReadWriteLock)?; -> let data = lock_handle.get_mut(); -> validate_and_modify_data(data)?; // Issue occurs here -> lock_handle.drop_lock(); -> ``` - -# Solution - -Given the context of the problem that you have described above, this section describes the solution that you are proposing to this problem. - -An example of what to include in this section is: - -> Given the problem described above, this pull request introduces a higher-level abstraction that is meant to allow for mutexes to be locked, operations to be performed, and then for mutexes to be unlocked regardless of the result of a given operation. This is introduced as a trait called `MutexLockHandler` which is defined as follows: -> ```rust -> trait MutexLockHandler { -> fn lock_and_handle(&self, lock: Lock, handler: F) -> Result where F: FnOnce(data: &mut I) -> O; -> } -> ``` -> A generic implementation of the above trait is then provided on `Mutex` which handles the locking, handling, and unlocking in a safe manner, the following is what the implementation of the above function looks like: -> ```rust -> fn lock_and_handle(&self, lock: Lock, handler: F) -> Result where F: FnOnce(data: &mut I) -> O { -> let lock_handle = mutex.lock(Lock::ReadWriteLock)?; -> let data = lock_handle.get_mut(); -> let result = handler(data); -> lock_handle.drop_lock(); -> Ok(result) -> } -> ``` - -# Recommended Review Path (Optional) - -This is an optional section where you can describe the recommended path to follow when reviewing this pull request. This is useful for large pull requests where there are many important changes and many small and inconsequential changes. - -An example of what to include in this section is: - -> The biggest chunk of changes to the logic were made to: -> * `src/mutex/handling.rs`. -> * `src/mutex/locking.rs`. -> So, the above are the recommended files to review first. \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f500cca6..15597930 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,12 +3,8 @@ name: Build on: push: branches: - - release/rcnet-v1 - - develop - - main - pull_request: - branches: - - release/rcnet-v1 + - release/* + - feature/* - develop - main @@ -19,85 +15,133 @@ jobs: strategy: matrix: build-target: - # native-json-interface Crate - - crate: native-json-interface + # radix-engine-toolkit Crate + - crate: radix-engine-toolkit target-triple: aarch64-apple-darwin 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 + - crate: radix-engine-toolkit 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 + - crate: radix-engine-toolkit 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,radix-engine" - - crate: native-json-interface + - crate: radix-engine-toolkit 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,radix-engine" - - crate: native-json-interface + - crate: radix-engine-toolkit 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,radix-engine" - - crate: native-json-interface + - crate: radix-engine-toolkit 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,radix-engine" - - crate: native-json-interface + - crate: radix-engine-toolkit 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,radix-engine" - - crate: native-json-interface + - crate: radix-engine-toolkit 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,radix-engine" - - crate: native-json-interface + - crate: radix-engine-toolkit 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,radix-engine" - - crate: native-json-interface + - crate: radix-engine-toolkit 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: "" - - crate: native-json-interface + - crate: radix-engine-toolkit target-triple: aarch64-linux-android 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 + - crate: radix-engine-toolkit target-triple: armv7-linux-androideabi 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 + - crate: radix-engine-toolkit + target-triple: i686-linux-android + 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 + # radix-engine-toolkit-uniffi Crate + - crate: radix-engine-toolkit-uniffi + target-triple: aarch64-apple-darwin + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + - crate: radix-engine-toolkit-uniffi + 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 + - crate: radix-engine-toolkit-uniffi + 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 + - crate: radix-engine-toolkit-uniffi + target-triple: aarch64-apple-ios + custom-linker: "" + custom-compiler: /usr/local/opt/llvm/bin/clang + custom-archiver: /usr/local/opt/llvm/bin/llvm-ar + - crate: radix-engine-toolkit-uniffi + 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 + - crate: radix-engine-toolkit-uniffi + target-triple: x86_64-pc-windows-gnu + custom-linker: "" + custom-compiler: x86_64-w64-mingw32-gcc + custom-archiver: x86_64-w64-mingw32-ar + - crate: radix-engine-toolkit-uniffi + 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 + - crate: radix-engine-toolkit-uniffi + 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 + - crate: radix-engine-toolkit-uniffi + 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 + - crate: radix-engine-toolkit-uniffi + target-triple: aarch64-linux-android + 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 + - crate: radix-engine-toolkit-uniffi + target-triple: armv7-linux-androideabi + 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 + - crate: radix-engine-toolkit-uniffi target-triple: i686-linux-android 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 @@ -142,179 +186,236 @@ jobs: then export $LINKER_ENVIRONMENT_VARIABLE=${{ matrix.build-target.custom-linker }} fi - + export CC=${{ matrix.build-target.custom-compiler }} export AR=${{ matrix.build-target.custom-archiver }} - - 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 +nightly build \ -Z build-std=std,panic_abort \ -Z build-std-features=panic_immediate_abort \ --target ${{ matrix.build-target.target-triple }} \ - --no-default-features \ - --release $features + --release unset $LINKER_ENVIRONMENT_VARIABLE export CC="/usr/local/opt/llvm/bin/clang" export AR="/usr/local/opt/llvm/bin/llvm-ar" - INCLUDE_DIRECTORY_PATH="$CRATE_PATH/target/${{ matrix.build-target.target-triple }}/release/include" - mkdir $INCLUDE_DIRECTORY_PATH + if [ "${{matrix.build-target.crate}}" == "radix-engine-toolkit" ]; then + INCLUDE_DIRECTORY_PATH="$CRATE_PATH/target/${{ matrix.build-target.target-triple }}/release/include" + mkdir $INCLUDE_DIRECTORY_PATH - rustup default nightly - cbindgen \ - --lang c \ - --config cbindgen.toml \ - --output "$INCLUDE_DIRECTORY_PATH/libradix_engine_toolkit.h" - rustup default stable + rustup default nightly + cbindgen \ + --lang c \ + --config cbindgen.toml \ + --output "$INCLUDE_DIRECTORY_PATH/libradix_engine_toolkit.h" + rustup default stable - echo "module RadixEngineToolkit {" > "$INCLUDE_DIRECTORY_PATH/module.modulemap" - echo " umbrella header \"libradix_engine_toolkit.h\"" >> "$INCLUDE_DIRECTORY_PATH/module.modulemap" - echo " export *" >> "$INCLUDE_DIRECTORY_PATH/module.modulemap" - echo "}" >> "$INCLUDE_DIRECTORY_PATH/module.modulemap" + echo "module RadixEngineToolkit {" > "$INCLUDE_DIRECTORY_PATH/module.modulemap" + echo " umbrella header \"libradix_engine_toolkit.h\"" >> "$INCLUDE_DIRECTORY_PATH/module.modulemap" + echo " export *" >> "$INCLUDE_DIRECTORY_PATH/module.modulemap" + echo "}" >> "$INCLUDE_DIRECTORY_PATH/module.modulemap" + fi ( BUILD_PATH="$CRATE_PATH/target/${{ matrix.build-target.target-triple }}/release" cd $BUILD_PATH BUILD_ARTIFACTS_PATH=$(find . -type f \( -name "*.a" -o -name "*.dylib" -o -name "*.dll" -o -name "*.so" -o -name "*.d" -o -name "*.wasm" \) -maxdepth 1) - tar -czf "./${{ matrix.build-target.target-triple }}.tar.gz" $BUILD_ARTIFACTS_PATH ./include + + if [ "${{matrix.build-target.crate}}" == "radix-engine-toolkit" ]; then + tar -czf "./${{ matrix.build-target.target-triple }}.tar.gz" $BUILD_ARTIFACTS_PATH ./include + else + tar -czf "./${{ matrix.build-target.target-triple }}.tar.gz" $BUILD_ARTIFACTS_PATH + fi ) ) - name: Upload Build Artifacts uses: actions/upload-artifact@v3 with: - name: "${{ matrix.build-target.crate }}-${{ matrix.build-target.target-triple }}.tar.gz" + name: "${{ matrix.build-target.crate }}-${{ matrix.build-target.target-triple }}" path: "./${{matrix.build-target.crate}}/target/${{ matrix.build-target.target-triple }}/release/${{ matrix.build-target.target-triple }}.tar.gz" - build-xc-framework: + create-uniffi-bindings: needs: [build] runs-on: macos-latest steps: - name: Checkout uses: actions/checkout@v3 + - name: Clone uniffi-bindgen-cs + uses: actions/checkout@v3 + with: + repository: radixdlt/uniffi-bindgen-cs + path: uniffi-bindgen-cs + submodules: 'recursive' - uses: actions/download-artifact@v3 with: path: artifacts - - name: Extract Artifacts - working-directory: artifacts + - name: Extracting the Library 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 + mkdir extracted + cd radix-engine-toolkit-uniffi-x86_64-apple-darwin + tar -xvzf x86_64-apple-darwin.tar.gz --directory="../extracted" working-directory: artifacts + - name: Generate the Bindings 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" + cargo run \ + --manifest-path="../../uniffi-bindgen/Cargo.toml" -- \ + generate ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \ + --language swift \ + --out-dir ./output \ + --lib-file ./libradix_engine_toolkit_uniffi.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 + cargo run \ + --manifest-path="../../uniffi-bindgen/Cargo.toml" -- \ + generate ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \ + --language kotlin \ + --out-dir ./output \ + --lib-file ./libradix_engine_toolkit_uniffi.a + + cargo run \ + --manifest-path="../../uniffi-bindgen-cs/bindgen/Cargo.toml" -- \ + ../../radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl \ + --out-dir ./output \ + --lib-file ./libradix_engine_toolkit_uniffi.a + working-directory: artifacts/extracted + - name: Compress Artifacts + run: | + tar -czf "./UniFFI-Bindings.tar.gz" ./output + working-directory: artifacts/extracted + - name: Upload Bindings uses: actions/upload-artifact@v3 with: - name: "RadixEngineToolkit.xcframework.tar.gz" - path: "./artifacts/native/RadixEngineToolkit.xcframework.tar.gz" + name: "UniFFI-Bindings" + path: "./artifacts/extracted/UniFFI-Bindings.tar.gz" - publish-csharp-nuget: + build-test-kit: needs: [build] - runs-on: ubuntu-latest + runs-on: macos-latest steps: - name: Checkout uses: actions/checkout@v3 + - name: Run Generator + run: cargo run + working-directory: generator + - name: Compress Generated + run: tar -czf "./test-kit.tar.gz" ./output + working-directory: generator + - name: Upload Generated Artifacts + uses: actions/upload-artifact@v3 + with: + name: "test-kit.tar.gz" + path: "./generator/test-kit.tar.gz" + + publish-swift-spm: + needs: [build, create-uniffi-bindings] + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Checkout Swift Egine toolkit + uses: actions/checkout@v3 + with: + repository: radixdlt/swift-engine-toolkit + token: ${{ secrets.RADIX_BOT_PAT }} + path: ./swift-engine-toolkit - uses: actions/download-artifact@v3 with: path: artifacts - - name: Extract Artifacts + - name: Build XCFramework 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"; + # The name of the crate that we will be creating the XCFramework and the bindings for. + CRATE_NAME="radix-engine-toolkit-uniffi" + + # The name of the directory to write the extracted libraries in. + EXTRACTED="extracted" + mkdir $EXTRACTED + + # Extract the UniFFI Bindings + mkdir $EXTRACTED/UniFFI-Bindings + tar -xvzf "UniFFI-Bindings/UniFFI-Bindings.tar.gz" --directory="./$EXTRACTED/UniFFI-Bindings" + + # Creating the include directory - this will be used in the XCFramework build steps + mkdir $EXTRACTED/include + cp $EXTRACTED/UniFFI-Bindings/output/radix_engine_toolkit_uniffiFFI.modulemap $EXTRACTED/include/module.modulemap + cp $EXTRACTED/UniFFI-Bindings/output/radix_engine_toolkit_uniffiFFI.h $EXTRACTED/include/radix_engine_toolkit_uniffiFFI.h + + # Extract the builds of the targets that we need. All of them have a common known pattern which + # we depend on for the extraction: `${CRATE_NAME}-${TARGET_TRIPLE}`. + for TARGET_TRIPLE in "aarch64-apple-darwin" "x86_64-apple-darwin" "aarch64-apple-ios-sim" "x86_64-apple-ios" "aarch64-apple-ios" + do + # Create a new directory for the target + mkdir $EXTRACTED/$TARGET_TRIPLE; + + BUILD_ARTIFACT="$CRATE_NAME-$TARGET_TRIPLE" + tar -xvzf "$BUILD_ARTIFACT/$TARGET_TRIPLE.tar.gz" --directory="./$EXTRACTED/$TARGET_TRIPLE" done - - name: Setup .NET SDK - uses: actions/setup-dotnet@5a3fa01c67e60dba8f95e2878436c7151c4b5f01 - with: - dotnet-version: 7.0.x - - name: Configure Version + rm -rf ./$EXTRACTED/*.tar.gz + + # Using Lipo to combine some of the libraries into fat libraries. + mkdir ./$EXTRACTED/macos-arm64_x86_64/ + mkdir ./$EXTRACTED/ios-simulator-arm64_x86_64 + + lipo -create \ + "./$EXTRACTED/aarch64-apple-darwin/libradix_engine_toolkit_uniffi.dylib" \ + "./$EXTRACTED/x86_64-apple-darwin/libradix_engine_toolkit_uniffi.dylib" \ + -o "./$EXTRACTED/macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib" + lipo -create \ + "./$EXTRACTED/aarch64-apple-ios-sim/libradix_engine_toolkit_uniffi.dylib" \ + "./$EXTRACTED/x86_64-apple-ios/libradix_engine_toolkit_uniffi.dylib" \ + -o "./$EXTRACTED/ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib" + + # Set proper id, so that Xcode can properly locate the dynamic library + install_name_tool -id @rpath/libradix_engine_toolkit_uniffi.dylib ./$EXTRACTED/aarch64-apple-ios/libradix_engine_toolkit_uniffi.dylib + install_name_tool -id @rpath/libradix_engine_toolkit_uniffi.dylib ./$EXTRACTED/macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib + install_name_tool -id @rpath/libradix_engine_toolkit_uniffi.dylib ./$EXTRACTED/ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib + + # Creating the XCFramework + xcodebuild -create-xcframework \ + -library "./$EXTRACTED/aarch64-apple-ios/libradix_engine_toolkit_uniffi.dylib" \ + -headers "./$EXTRACTED/include" \ + -library "./$EXTRACTED/macos-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib" \ + -headers "./$EXTRACTED/include" \ + -library "./$EXTRACTED/ios-simulator-arm64_x86_64/libradix_engine_toolkit_uniffi.dylib" \ + -headers "./$EXTRACTED/include" \ + -output "./$EXTRACTED/RadixEngineToolkitUniFFI.xcframework" + + - name: Publish to Swift Engine Toolkit 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=build.${CI_RUN_NUMBER} - VERSION=${CORE_VERSION}-${VERSION_SUFFIX} - - if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then - VERSION=${CORE_VERSION} + BRANCH=${{ github.ref_name }} + BUILD_CRATE_MANIFEST="./radix-engine-toolkit-uniffi/Cargo.toml" + CRATE_VERSION=$(cargo read-manifest --manifest-path $BUILD_CRATE_MANIFEST | jq -r '.version') + LAST_COMMIT_SHA=$(git rev-parse --short HEAD) + SPM_VERSION="$CRATE_VERSION-$LAST_COMMIT_SHA" + SET_UPSTREAM_FLAG="" + + cd swift-engine-toolkit + REMOTE_BRANCH=$(git ls-remote --heads origin $BRANCH) + + if [ -z "$REMOTE_BRANCH" ] + then + git checkout -b $BRANCH + # Allows creating branch on remote + SET_UPSTREAM_FLAG="-u" + else + git fetch origin $BRANCH + git checkout $BRANCH + git pull origin $BRANCH fi - sed -i "s/\(\)[^<>]*\(<\/version>\)/\1$VERSION\2/g" interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec + cp -R ../artifacts/extracted/RadixEngineToolkitUniFFI.xcframework ./Sources/RadixEngineToolkitUniFFI/RadixEngineToolkitUniFFI.xcframework + cp -R ../artifacts/extracted/UniFFI-Bindings/output/radix_engine_toolkit_uniffi.swift ./Sources/EngineToolkitUniFFI/radix_engine_toolkit_uniffi.swift - echo "Configured Version: $VERSION" - - name: NuGet Pack - working-directory: interop/csharp - run: nuget pack - - name: Publish Packages - working-directory: interop/csharp - run: dotnet nuget push RadixDlt.RadixEngineToolkit.Native.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }} \ No newline at end of file + git add . + git commit -m "Update RET from $BRANCH - $LAST_COMMIT_SHA" + git tag -a $SPM_VERSION -m "RET update from $BRANCH - $LAST_COMMIT_SHA" + git push $SET_UPSTREAM_FLAG origin $BRANCH + git push origin $SPM_VERSION + + - name: Upload Artifacts + uses: actions/upload-artifact@v3 + with: + name: "RadixEngineToolkitUniFFI.xcframework" + path: "./artifacts/extracted/RadixEngineToolkitUniFFI.xcframework" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 5d56f571..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Release - -on: - release: - types: [published] - -jobs: - release: - runs-on: ubuntu-latest - - steps: - - name: Download artifact - id: download-artifact - uses: dawidd6/action-download-artifact@v2 - with: - github_token: ${{secrets.GITHUB_TOKEN}} - workflow: build.yml - path: artifacts - - - name: Upload artifact to release - uses: ncipollo/release-action@v1 - with: - artifacts: artifacts/radix-engine-toolkit-*/* - allowUpdates: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a4dcf7a2..ca5cf2b0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,52 +3,26 @@ name: Test on: pull_request: branches: - - betanet - - develop - main + - develop + - release/* push: branches: - - betanet - - develop - main + - develop + - release/* env: CARGO_TERM_COLOR: always jobs: - rust-test: + test: runs-on: ubuntu-latest strategy: matrix: - crate: [ native-json-interface, radix-engine-toolkit ] + crate: [ radix-engine-toolkit, radix-engine-toolkit-core ] steps: - uses: actions/checkout@v3 - - name: Install Targets - run: rustup target install wasm32-unknown-unknown - name: Run tests - run: cargo test --manifest-path ./${{ matrix.crate }}/Cargo.toml --verbose - - schema-and-example-tests: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Generating new schema and examples - run: | - cd schema - mv out old-out - mkdir -p out/examples - mkdir -p out/schema - cargo run - - name: Comparing old examples to newly generated - run: | - cd schema - cmp --quiet ./out/examples/request-examples.md ./old-out/examples/request-examples.md && exit 0 || exit 1 - - name: Comparing old schema to newly generated - run: | - cd schema - 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 - exit 0 \ No newline at end of file + run: cargo test --manifest-path ./${{ matrix.crate }}/Cargo.toml --verbose \ No newline at end of file diff --git a/.gitignore b/.gitignore index 55af7909..0f39c29b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ openapi-generator-cli-6.0.1.jar .DS_Store Cargo.lock .idea -build \ No newline at end of file +output +./radixdlt-scrypto/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index ad647571..e5b98a7b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,28 +1,41 @@ { "rust-analyzer.linkedProjects": [ - "Cargo.toml", - "native-json-interface/Cargo.toml", - "cli-json-interface/Cargo.toml", - "benches/Cargo.toml", + "radix-engine-toolkit-uniffi/Cargo.toml", + "radix-engine-toolkit-core/Cargo.toml", + "radix-engine-toolkit/Cargo.toml", + "generator/Cargo.toml", + "uniffi-bindgen/Cargo.toml" ], "cSpell.words": [ - "bech", - "Decompilation", - "decompile", - "decompiled", - "eddsa", - "instantiatable", - "Instrumenter", - "persistable", - "repr", - "Sbor", - "Scrypto", - "Secp", - "Substate", - "substates", - "Untimed", - "virtualizable", - "Wasmer", - "Wasmi" - ] + "adapanet", + "ansharnet", + "archiver", + "cbrt", + "decryptors", + "Devopsnet", + "dumunet", + "enkinet", + "gilganet", + "hammunet", + "kisharnet", + "Localnet", + "mardunet", + "Milestonenet", + "nebunet", + "nergalnet", + "openapi", + "powi", + "radixdlt", + "RCNet", + "Releasenet", + "Ruid", + "rustfmt", + "Sandpitnet", + "testcases", + "thiserror", + "unhashed", + "uniffi", + "unstake", + "walkdir" + ], } \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index 5d634fa8..00000000 --- a/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[workspace] -members = [ - "radix-engine-toolkit", - "schema", - "toolkit-derive", -] \ No newline at end of file diff --git a/Changelog.md b/Changelog.md new file mode 100644 index 00000000..0dec4d6e --- /dev/null +++ b/Changelog.md @@ -0,0 +1,290 @@ +# 0.10.0 (6 July 2023) + +* The instruction model of the `radix-engine-toolkit` crate no longer performs any aliasing of instructions. All aliasing is to be handled by transaction manifest builders. + +# 0.10.0-damson.1 (26-June-2023) + +No interface changes were made with this internal release, just internal changes to the toolkit as a result of bumping the version of the Scrypto Dependency. + +# 0.10.0 (26-June-2023) + +* All builds of the Radix Engine Toolkit now come with a `test-kit.tar.gz` file containing many test vectors to use when updating the toolkit wrappers to be compatible with the toolkit. More specifically, it includes the following: + * The JSON Schema of all of the models used by the toolkit. + * Test vectors of serialized models to include as part of the toolkit wrappers to ensure correct serialization/deserialization of models. + * Test vectors for the input and output of functions to include as part of toolkit wrappers to ensure that the wrappers are able to invoke methods on the toolkit and receive expected responses. +* All across the Radix Engine Toolkit all types which are serialized as discriminated unions now have a discriminator called `kind` instead of `type` and a value field of `value`. There are some exceptions to this where the value is not a single value but multiple such as `SignatureWithPublicKey`. +* The Radix Engine Toolkit is now made up of modules. As an example, there is an `intent` module that has functions such as `intent_hash`, `intent_compile`, `intent_decompile`, and `intent_statically_validate`. + * All functions now follow the following naming scheme: `${module_name}_${function_name}`, thus, you can expect that all of the function names from the previous version of the toolkit has been renamed to adhere to this. +* The `network_id` is now being serialized as a `String` all across the toolkit in a consistent manner. + +## Functions + +* The `decompile_unknown_intent` function has been removed. +* The `encode_address` and `decode_address` functions have been **temporarily** removed. + +### `build` Module + +* Added a new `build` module which has functions related to the Radix Engine Toolkit build being used. + +#### `build_information` Function + +* The `information` function has been renamed to `build_information` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `build_information` function no longer returns the `last_commit_hash`, instead, it returns the `scrypto_dependency` version that is currently in use. + +```jsonc +{ + // The version of the Radix Engine Toolkit + "version": "0.10.0", + // The version of Scrypto used is returned, not a commit hash of the RET + "scrypto_dependency": { + "kind": "Branch", // RET is depending on a specific branch of Scrypto + "value": "feature/fee-locks-in-execution-trace" // This is the branch is depends on + } +} +``` + +### `instructions` Module + +* Added a new `instructions` module of functions that can be performed on manifest instructions. + +#### `instructions_hash` Function + +* Added a new function to the `instructions` module that returns the hash of some given instructions: `instructions_hash`. + +#### `instructions_convert` Function + +* The `convert_manifest` function has been renamed to `instructions_convert`: + * To be consistent with module naming scheme adopted with this version of the toolkit. + * Because the function did not need to take a full manifest (instructions + blobs), it realistically only needed to take the instructions as input to convert them to another form. +* The `instructions_output_kind` field of the `instructions_convert` input has been renamed to `instructions_kind`. +* The `manifest` field of the `instructions_convert` input has been: + * Renamed to `instructions`. + * Only requires the instructions and not a complete `TransactionManifest`. + +#### `instructions_compile` Function + +* Added a new function to the `instructions` module that compiles the instructions by SBOR encoding them: `instructions_compile`. + +#### `instructions_decompile` Function + +* Added a new function to the `instructions` module that decompiles a byte array into instructions by SBOR decoding the byte array into instructions: `instructions_decompile`. + +#### `instructions_statically_validate` Function + +* Added a new function to the `instructions` module that validates the instructions statically: `instructions_statically_validate`. + +#### `instructions_extract_addresses` Function + +* The `extract_addresses_from_manifest` function has been renamed to `instructions_extract_addresses`: + * To be consistent with the module naming scheme adopted with this version of the toolkit. + * Because the function did not need to take a full manifest (instructions + blobs), it realistically only needed to take the instructions to extract the addresses from there. +* The `manifest` field of the `instructions_extract_addresses` input has been: + * Renamed to `instructions`. + * Only requires the instructions and not a complete `TransactionManifest`. +* The `instructions_extract_addresses` output has changed, please refer to the JSON Schema and Function examples provided in the test kit for more information. + +### `manifest` Module + +* Added a new `manifest` module of functions that can be performed on transaction manifests. + +#### `manifest_hash` Function + +* Added a new function to the `manifest` module that returns the hash of some given manifest: `manifest_hash`. + +#### `manifest_compile` Function + +* Added a new function to the `manifest` module that compiles the manifest by SBOR encoding it: `manifest_compile`. + +#### `manifest_decompile` Function + +* Added a new function to the `manifest` module that decompiles a byte array into manifest by SBOR decoding the byte array into manifest: `manifest_decompile`. + +#### `manifest_statically_validate` Function + +* Added a new function to the `manifest` module that validates the manifest statically: `manifest_statically_validate`. + + +### `intent` Module + +* Added a new `intent` module of functions that can be performed on transaction intents. + +#### `intent_hash` Function + +* The `hash_transaction_intent` function has been renamed to `intent_hash` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `hash_transaction_intent` output is no longer a complex object of keys and values, it's now just a hex-encoded string of the hash. + +#### `intent_compile` Function + +* The `compile_transaction_intent` function has been renamed to `intent_compile` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `compile_transaction_intent` output is no longer a complex object of keys and values, it's now just a hex-encoded string of the compiled intent. + +#### `intent_decompile` Function + +* The `decompile_transaction_intent` function has been renamed to `intent_decompile` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `instructions_output_kind` field of the `intent_decompile` input has been renamed to `instructions_kind`. + +#### `intent_statically_validate` Function + +* Added a new function to the `intent` module that validates the intent statically: `intent_statically_validate`. + +### `signed_intent` Module + +* Added a new `signed_intent` module of functions that can be performed on signed transaction intents. + +#### `signed_intent_hash` Function + +* The `hash_signed_transaction_intent` function has been renamed to `signed_intent_hash` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `hash_signed_transaction_intent` output is no longer a complex object of keys and values, it's now just a hex-encoded string of the hash. + +#### `signed_intent_compile` Function + +* The `compile_signed_transaction_intent` function has been renamed to `signed_intent_compile` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `compile_signed_transaction_intent` output is no longer a complex object of keys and values, it's now just a hex-encoded string of the compiled signed intent. + +#### `signed_intent_decompile` Function + +* The `decompile_signed_transaction_intent` function has been renamed to `signed_intent_decompile` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `instructions_output_kind` field of the `signed_intent_decompile` input has been renamed to `instructions_kind`. + +#### `signed_intent_statically_validate` Function + +* Added a new function to the `signed_intent` module that validates the signed_intent statically: `signed_intent_statically_validate`. + +### `notarized_transaction` Module + +* Added a new `notarized_transaction` module of functions that can be performed on notarized transaction intents. + +#### `notarized_transaction_hash` Function + +* The `hash_notarized_transaction` function has been renamed to `notarized_transaction_hash` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `hash_notarized_transaction` output is no longer a complex object of keys and values, it's now just a hex-encoded string of the hash. + +#### `notarized_transaction_compile` Function + +* The `compile_notarized_transaction` function has been renamed to `notarized_transaction_compile` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `compile_notarized_transaction` output is no longer a complex object of keys and values, it's now just a hex-encoded string of the compiled signed intent. + +#### `notarized_transaction_decompile` Function + +* The `decompile_notarized_transaction` function has been renamed to `notarized_transaction_decompile` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `instructions_output_kind` field of the `notarized_transaction_decompile` input has been renamed to `instructions_kind`. + +#### `notarized_transaction_statically_validate` Function + +* The `statically_validate_transaction` function has been renamed to `notarized_transaction_statically_validate` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `compiled_notarized_intent` field of the `notarized_transaction_statically_validate` input has been renamed to `notarized_transaction` and is no longer a compiled notarized transaction. +* The `validation_config` struct has a new added field for message validation `message_validation`. + +### `derive` Module + +* Added a new `derive` module for all of the derivation operations that can be done by the toolkit. + +#### `derive_virtual_account_address_from_public_key` Function + +* The `derive_virtual_account_address` function has been renamed to `derive_virtual_account_address_from_public_key`: + * To be consistent with module naming scheme adopted with this version of the toolkit. + * To have a more descriptive name of what it does exactly. +* The `derive_virtual_account_address_from_public_key` output is no longer a complex object of keys and values, it's now just a string of the virtual account address. + +#### `derive_virtual_identity_address_from_public_key` Function + +* The `derive_virtual_identity_address` function has been renamed to `derive_virtual_identity_address_from_public_key`: + * To be consistent with module naming scheme adopted with this version of the toolkit. + * To have a more descriptive name of what it does exactly. +* The `derive_virtual_identity_address_from_public_key` output is no longer a complex object of keys and values, it's now just a string of the virtual identity address. + +#### `derive_virtual_signature_non_fungible_global_id_from_public_key` Function + +* Added a new function to the `derive` module that derives the non-fungible global id of the virtual signature badge given a public key: `derive_virtual_signature_non_fungible_global_id_from_public_key`. + +#### `derive_virtual_account_address_from_olympia_account_address` Function + +* The `derive_babylon_address_from_olympia_address` function has been renamed to `derive_virtual_account_address_from_olympia_account_address`: + * To be consistent with module naming scheme adopted with this version of the toolkit. + * To have a more descriptive name of what it does exactly. +* The `derive_virtual_account_address_from_olympia_account_address` output no longer includes the public key associated with the Olympia account, just a string of the Babylon account address. The public key can be derived from an olympia account address through the `derive_public_key_from_olympia_account_address` function. + +#### `derive_public_key_from_olympia_account_address` Function + +* Added a new function to the `derive` module that derives the public key given an Olympia account address: `derive_public_key_from_olympia_account_address`. +* The output of this function is a string and not a `PublicKey` because Olympia only supports Ecdsa Secp256k1 and there is no need to have a discriminated union when we know what the type is. + +#### `derive_resource_address_from_olympia_resource_address` Function + +* Added a new function to the `derive` module that derives the address of a resource from the Olympia network on the Babylon network: `derive_resource_address_from_olympia_resource_address`. + +#### `derive_olympia_account_address_from_public_key` Function + +* The `network` field of the `derive_olympia_account_address_from_public_key` input has been renamed to `olympia_network`. +* The `derive_olympia_account_address_from_public_key` output is no longer a complex object of keys and values, it's now just a string of the address. + +#### `derive_node_address_from_public_key` Function + +* Added a new function to the `derive` module that derives the node address from a public key. + +### `execution` Module + +* Added a new `execution` module for everything related to transaction execution and analysis. + +#### `execution_analyze` Function + +* The `analyze_transaction_execution` function has been renamed to `execution_analyze` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `transaction_receipt` field of the `execution_analyze` input has been renamed to `preview_receipt`. +* The `manifest` field of the `execution_analyze` input has been: + * Renamed to `instructions`. + * Only requires the instructions and not a complete `TransactionManifest`. +* The `execution_analyze` output has completely changed, please refer to the JSON Schema and function examples in the test kit for more information. + +### `utils` Module + +* Added a new `utils` module for miscellaneous functions needed by clients. + +#### `utils_known_address` + +* The `known_entity_addresses` function has been renamed to `utils_known_address` to be consistent with module naming scheme adopted with this version of the toolkit. +* The `utils_known_address` input is no longer a complex object of keys and values, it's just a string of the network id. +* The `utils_known_address` output has completely changed, please refer to the JSON Schema and function examples in the test kit for more information. + +### `manifest_sbor` Module + +* Added a `manifest_sbor` module for all manifest SBOR related operations. + +#### `manifest_sbor_decode_to_string` Function + +* Added a new function to the `manifest_sbor` module for decoding an manifest SBOR payload to a string either with or without a schema, additionally, this function can output the manifest representation, programmatic JSON, model JSON, and natural JSON representation of the payload: `manifest_sbor_decode_to_string`. + +### `scrypto_sbor` Module + +* Added a `scrypto_sbor` module for all scrypto SBOR related operations. + +#### `scrypto_sbor_decode_to_string` Function + +* Added a new function to the `scrypto_sbor` module for decoding an scrypto SBOR payload to a string either with or without a schema, additionally, this function can output the programmatic JSON, model JSON, and natural JSON representation of the payload: `scrypto_sbor_decode_to_string`. + +## Models + +### Transaction + +* The `TransactionIntent` model has an additional `message` field for messages. The structure of the `message` field can be found in the JSON Schema provided in the test-kit. + +### Cryptographic + +* The `PublicKeyHash` discriminator has been renamed to `kind`. +* The `PublicKeyHash` variants have been shortened to be `Secp256k1` and `Ed25519` respectively. +* The `PublicKey` discriminator has been renamed to `kind`. +* The `PublicKey` variants have been shortened to be `Secp256k1` and `Ed25519` respectively. +* The `SignatureWithPublicKey` discriminator has been renamed to `kind`. +* The `SignatureWithPublicKey` variants have been shortened to be `Secp256k1` and `Ed25519` respectively. +* The `Signature` discriminator has been renamed to `kind`. +* The `Signature` variants have been shortened to be `Secp256k1` and `Ed25519` respectively. + +### Instruction + +* The `Instruction` discriminator has been renamed to `kind`. +* The `Instruction` variant names are no longer SCREAMING_SNAKE_CASE and are now in PascalCase. + +### Value Models + +* The `ManifestAstValue` model has been renamed to `ManifestValue`. +* All type aliases have been removed from the `ManifestValue` model, namely, `Some`, `None`, `Err`, `Ok`. +* Enums in the `ManifestValue` model only accept u8 discriminators. Clients that wish to use named discriminators are free to define that mapping in the wrapper. diff --git a/README.md b/README.md index 59dcd13d..b7eda423 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ The Radix Engine Toolkit is a multiplatform library written in Rust that exposes Babylon transactions are composed of a number of different parts, but their building blocks essentially boil down to: a transaction header, a manifest, and signatures which might either be intent signatures or a notary signature depending on what exactly was signed. The diagram below illustrates the relationship and names of the different parts of a transaction. -![image](./images/v0.5.0-transaction-model.png) +![image](./assets/v0.5.0-transaction-model.png) When we have a transaction intent, getting to a signed transaction intent requires that the transaction intent is "compiled" and signed. In this context, compiling something simply refers to encoding it in SBOR. Once all of the signers have signed the compiled transaction intent, then we have all we need to for a signed transaction intent. @@ -38,70 +38,10 @@ With the above in mind, this library allows for the following functionality to b This section gives a high-level overview of the architecture of the Radix Engine Toolkit and is useful for developers hoping to extend the Radix Engine Toolkit to add additional interfaces and additional ways to talk to use the core functionality available in the library. -![image](./images/library-overview.png) +![image](./assets/library-overview.png) The core functionality of the library is implemented in the `radix-engine-toolkit-core` crate. This crate has the definition of the requests, their responses, how they are validated, and how they are handled and fulfilled. This crate utilizes the Scrypto standard library as well as other dependencies from the Scrypto repository to handle requests. If there is a need to extend the library to handle a new request type (e.g. a request to statically validate transactions) then it is implemented in this crate. Utilizing the core crate are a number of "interface" crates which expose the functionality of the Radix Engine Toolkit for different platforms and through different serialization techniques. Currently, all communication into and out of toolkit happens in JSON, although, if other serialization techniques are desirable (e.g. CBOR or Protocol Buffers), then an additional "interface" crates may be implemented which make use of these serialization techniques. -In addition to that, if it is desirable to expose the functionality in different ways (e.g. as a REST API) then a simple server may be implemented as an "interface" for the toolkit which would expose the `radix-engine-toolkit-core` functionality through a REST API interface. - -With the above in mind, this means that if you were to build the toolkit from source, you would not build the `radix-engine-toolkit-core` crate. Instead, you would build one of the interface creates available in the repository. There are currently three main interfaces implemented for the Radix Engine Toolkit: - -1. WASM JSON Interface: This interface is implemented in the `radix-engine-toolkit-wasm` crate and exposes a WASM interface with JSON as the underlying serialization protocol for the interface. This is useful when you are developing web applications which require functionality available in the Radix Engine Toolkit. -2. JNI JSON Interface: This interface is implemented in the `radix-engine-toolkit-jni` crate and exposes a JNI interface with JSON as the underlying serialization protocol for the interface. This is useful when you want to use the toolkit with a JVM language such as Kotlin, Java, or when you want to use it in building Android applications. Since JNI interfaces require a specific package and namespace, this interface assumes the wrapper to be unpackaged and assumes that the functions will be exposed through a class called `RadixEngineToolkitFFI`. -3. Native JSON Interface: This interface is implemented in the `radix-engine-toolkit-native` crate and exposes a c-style function interface with JSON as the underlying serialization protocol for the interface. This is useful for most applications where you want to build a library that would run on different platforms. - -## Exposed Functionality - -A full document of the functionality exposed by the Radix Engine Toolkit can be found in the [request examples](./docs-examples-generator/request-examples.md) document. This has a full list of the different functions exposed, what their functionality is, and what a sample request and response looks like for a given request type. - -## Schema and Specification - -Although the Radix Engine Toolkit is not a traditional REST API, its uses OpenAPI to define the specification of the models used for the requests, responses, instructions, and the value model used by the toolkit. The OpenAPI specification can be found in the [specification](./spec/transaction-api-spec.yaml) document - -## Building From Source - -This section describes how you can build your own Radix Engine Toolkit directly from source. It describes what the process looks like and also describes what the needed dependencies are. - -### Dependencies - -1. To build the Radix Engine Toolkit, you need to have both the stable and nightly versions of rust installed. You can do that through the following commands: - - ```shell - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - rustup default nightly - rustup default stable - rustup update - ``` - -2. To allow the library to be cross compiled to different platforms, you must install the different compilation targets through `rustup`. The following command installs a set of targets which are commonly used for the toolkit, however, you may want to add additional targets or remove some of those targets if they are not of interest to you. - - ```shell - rustup target install aarch64-linux-android aarch64-apple-darwin x86_64-unknown-linux-gnu x86_64-apple-darwin i686-linux-android aarch64-apple-ios aarch64-apple-ios-sim wasm32-unknown-unknown x86_64-pc-windows-gnu armv7-linux-androideabi - rustup +nightly target install aarch64-linux-android aarch64-apple-darwin x86_64-unknown-linux-gnu x86_64-apple-darwin i686-linux-android aarch64-apple-ios aarch64-apple-ios-sim wasm32-unknown-unknown x86_64-pc-windows-gnu armv7-linux-androideabi - ``` - -3. (Optional) Certain build targets require that a custom compiler and linker are used. An example of one of those targets is Android which requires these dependencies from the NDK. This library has been built successfully through NDK version r22b and therefore this is the recommended version to install. The following command shows how this may be installed, however, you must keep in mind that you will need to know the path of its installation as it is required for the build script. - - ```shell - 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 - ``` - - In addition to the above, depending on the architecture of the machine that the build will run on, you may need additional compilers and linkers (e.g. building for a `x86_64-pc-windows-gnu` target on an `aarch64-apple-darwin` machine requires a custom compiler). - -### Building the Library - -The Radix Engine Toolkit comes with a [bash script](./build-specific.sh) to make the building of the library easier. This build script requires certain environment variables to be set before running it: - -1. `CRATE_NAME`: This is the name of the crate to build (e.g. `radix-engine-toolkit-native`) -2. `TARGET_TRIPLE`: The target to build the radix engine toolkit for (e.g. `aarch64-apple-darwin`) -3. `CUSTOM_COMPILER`: The custom compiler to use to use for this build. When unsure, set this to the path of your current clang binary and try running this script (e.g. `/usr/bin/clang`). -4. `CUSTOM_ARCHIVER`: The custom archiver to use to use for this build. When unsure, set this to the path of your current llvm-ar binary and try running this script (e.g. `/usr/bin/llvm-ar`). -5. `CUSTOM_LINKER`: The custom linker to use to use for this build. When unsure, do not set this variable to anything and try running this script. This variable should not be needed for all targets. - -Once you set these environment variables, building the toolkit is as easy as: -```shell -./build-specific.sh -``` +In addition to that, if it is desirable to expose the functionality in different ways (e.g. as a REST API) then a simple server may be implemented as an "interface" for the toolkit which would expose the `radix-engine-toolkit-core` functionality through a REST API interface. \ No newline at end of file diff --git a/radix-engine-toolkit/src/example/engine_identifier/transient_identifier.rs b/add_license.py similarity index 55% rename from radix-engine-toolkit/src/example/engine_identifier/transient_identifier.rs rename to add_license.py index 9b1ffd49..9e06f5f8 100644 --- a/radix-engine-toolkit/src/example/engine_identifier/transient_identifier.rs +++ b/add_license.py @@ -1,3 +1,6 @@ +import os + +LICENSE: str =""" // 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 @@ -14,31 +17,25 @@ // 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(), - } -} +def main() -> None: + license: str = LICENSE.strip() + for (root_path, _, file_names) in os.walk(os.path.dirname(os.path.realpath(__file__))): + for file_name in file_names: + if not file_name.endswith('.rs'): + continue -pub fn u32() -> TransientIdentifier { - TransientIdentifier::U32 { value: 1 } -} + file_path: str = os.path.join(root_path, file_name) -pub fn bucket_id1() -> BucketId { - BucketId(string()) -} + with open(file_path, 'r') as file: + content: str = file.read() -pub fn bucket_id2() -> BucketId { - BucketId(u32()) -} + if license not in content: + content = license + '\n\n' + content -pub fn proof_id1() -> ProofId { - ProofId(string()) -} + with open(file_path, 'w') as file: + file.write(content) -pub fn proof_id2() -> ProofId { - ProofId(u32()) -} +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/images/library-overview.png b/assets/library-overview.png similarity index 100% rename from images/library-overview.png rename to assets/library-overview.png diff --git a/images/v0.5.0-transaction-model.png b/assets/v0.5.0-transaction-model.png similarity index 100% rename from images/v0.5.0-transaction-model.png rename to assets/v0.5.0-transaction-model.png diff --git a/benches/Cargo.toml b/benches/Cargo.toml deleted file mode 100644 index 30971308..00000000 --- a/benches/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[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 deleted file mode 100644 index 6399035f..00000000 --- a/benches/benches/decompilation_benchmark.rs +++ /dev/null @@ -1,171 +0,0 @@ -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 deleted file mode 100644 index 470a7fa4..00000000 --- a/benches/benches/transaction.hex +++ /dev/null @@ -1 +0,0 @@ -4d2102210221022109070107220a3f050000000000000a4a050000000000000ae0ab8ab4f991510522000120072103a74d9e05834d6913aba6835b32b03fb39cbd0e739d63580ebeb6bb0aa5a8812301000900e1f505080500210220220321038004869696edc6120c67eb6f000a3e4e13d13ae10755e2f378ca9c250c086c6f636b5f6665652101850000e8890423c78a0000000000000000000000000000000000000000000000002004800000000000000000000000000000000000000000000000000000010c1a4e6f6e46756e6769626c655265736f757263654d616e616765720c1a6372656174655f776974685f696e697469616c5f737570706c792105220100210321032022002021002022002200010740200c00230c0c020b6465736372697074696f6e1b5573656420666f72206d756c74697661756c742074657374696e67046e616d650a4d7946756e546f6b656e2322210300000222020122000122000122000121028002000000000000000000000000000000000000000000000000000087021a440d31b0c16a178918a06a7a07882d69cf7cd963c0643bab85e922010001000222020122000122000122000121028002000000000000000000000000000000000000000000000000000087021a440d31b0c16a178918a06a7a07882d69cf7cd963c0643bab85e922010004000222020122000122000122000121028002000000000000000000000000000000000000000000000000000087021a440d31b0c16a178918a06a7a07882d69cf7cd963c0643bab85e9220100238721904e01000000000000000101210001000000000000000201210001000000000000000301210001000000000000000401210001000000000000000501210001000000000000000601210001000000000000000701210001000000000000000801210001000000000000000901210001000000000000000a01210001000000000000000b01210001000000000000000c01210001000000000000000d01210001000000000000000e01210001000000000000000f01210001000000000000001001210001000000000000001101210001000000000000001201210001000000000000001301210001000000000000001401210001000000000000001501210001000000000000001601210001000000000000001701210001000000000000001801210001000000000000001901210001000000000000001a01210001000000000000001b01210001000000000000001c01210001000000000000001d01210001000000000000001e01210001000000000000001f01210001000000000000002001210001000000000000002101210001000000000000002201210001000000000000002301210001000000000000002401210001000000000000002501210001000000000000002601210001000000000000002701210001000000000000002801210001000000000000002901210001000000000000002a01210001000000000000002b01210001000000000000002c01210001000000000000002d01210001000000000000002e01210001000000000000002f01210001000000000000003001210001000000000000003101210001000000000000003201210001000000000000003301210001000000000000003401210001000000000000003501210001000000000000003601210001000000000000003701210001000000000000003801210001000000000000003901210001000000000000003a01210001000000000000003b01210001000000000000003c01210001000000000000003d01210001000000000000003e01210001000000000000003f01210001000000000000004001210001000000000000004101210001000000000000004201210001000000000000004301210001000000000000004401210001000000000000004501210001000000000000004601210001000000000000004701210001000000000000004801210001000000000000004901210001000000000000004a01210001000000000000004b01210001000000000000004c01210001000000000000004d01210001000000000000004e01210001000000000000004f01210001000000000000005001210001000000000000005101210001000000000000005201210001000000000000005301210001000000000000005401210001000000000000005501210001000000000000005601210001000000000000005701210001000000000000005801210001000000000000005901210001000000000000005a01210001000000000000005b01210001000000000000005c01210001000000000000005d01210001000000000000005e01210001000000000000005f01210001000000000000006001210001000000000000006101210001000000000000006201210001000000000000006301210001000000000000006401210001000000000000006501210001000000000000006601210001000000000000006701210001000000000000006801210001000000000000006901210001000000000000006a01210001000000000000006b01210001000000000000006c01210001000000000000006d01210001000000000000006e01210001000000000000006f01210001000000000000007001210001000000000000007101210001000000000000007201210001000000000000007301210001000000000000007401210001000000000000007501210001000000000000007601210001000000000000007701210001000000000000007801210001000000000000007901210001000000000000007a01210001000000000000007b01210001000000000000007c01210001000000000000007d01210001000000000000007e01210001000000000000007f01210001000000000000008001210001000000000000008101210001000000000000008201210001000000000000008301210001000000000000008401210001000000000000008501210001000000000000008601210001000000000000008701210001000000000000008801210001000000000000008901210001000000000000008a01210001000000000000008b01210001000000000000008c01210001000000000000008d01210001000000000000008e01210001000000000000008f01210001000000000000009001210001000000000000009101210001000000000000009201210001000000000000009301210001000000000000009401210001000000000000009501210001000000000000009601210001000000000000009701210001000000000000009801210001000000000000009901210001000000000000009a01210001000000000000009b01210001000000000000009c01210001000000000000009d01210001000000000000009e01210001000000000000009f0121000100000000000000a00121000100000000000000a10121000100000000000000a20121000100000000000000a30121000100000000000000a40121000100000000000000a50121000100000000000000a60121000100000000000000a70121000100000000000000a80121000100000000000000a90121000100000000000000aa0121000100000000000000ab0121000100000000000000ac0121000100000000000000ad0121000100000000000000ae0121000100000000000000af0121000100000000000000b00121000100000000000000b10121000100000000000000b20121000100000000000000b30121000100000000000000b40121000100000000000000b50121000100000000000000b60121000100000000000000b70121000100000000000000b80121000100000000000000b90121000100000000000000ba0121000100000000000000bb0121000100000000000000bc0121000100000000000000bd0121000100000000000000be0121000100000000000000bf0121000100000000000000c00121000100000000000000c10121000100000000000000c20121000100000000000000c30121000100000000000000c40121000100000000000000c50121000100000000000000c60121000100000000000000c70121000100000000000000c80121000100000000000000c90121000100000000000000ca0121000100000000000000cb0121000100000000000000cc0121000100000000000000cd0121000100000000000000ce0121000100000000000000cf0121000100000000000000d00121000100000000000000d10121000100000000000000d20121000100000000000000d30121000100000000000000d40121000100000000000000d50121000100000000000000d60121000100000000000000d70121000100000000000000d80121000100000000000000d90121000100000000000000da0121000100000000000000db0121000100000000000000dc0121000100000000000000dd0121000100000000000000de0121000100000000000000df0121000100000000000000e00121000100000000000000e10121000100000000000000e20121000100000000000000e30121000100000000000000e40121000100000000000000e50121000100000000000000e60121000100000000000000e70121000100000000000000e80121000100000000000000e90121000100000000000000ea0121000100000000000000eb0121000100000000000000ec0121000100000000000000ed0121000100000000000000ee0121000100000000000000ef0121000100000000000000f00121000100000000000000f10121000100000000000000f20121000100000000000000f30121000100000000000000f40121000100000000000000f50121000100000000000000f60121000100000000000000f70121000100000000000000f80121000100000000000000f90121000100000000000000fa0121000100000000000000fb0121000100000000000000fc0121000100000000000000fd0121000100000000000000fe0121000100000000000000ff01210001000000000000010001210001000000000000010101210001000000000000010201210001000000000000010301210001000000000000010401210001000000000000010501210001000000000000010601210001000000000000010701210001000000000000010801210001000000000000010901210001000000000000010a01210001000000000000010b01210001000000000000010c01210001000000000000010d01210001000000000000010e01210001000000000000010f01210001000000000000011001210001000000000000011101210001000000000000011201210001000000000000011301210001000000000000011401210001000000000000011501210001000000000000011601210001000000000000011701210001000000000000011801210001000000000000011901210001000000000000011a01210001000000000000011b01210001000000000000011c01210001000000000000011d01210001000000000000011e01210001000000000000011f01210001000000000000012001210001000000000000012101210001000000000000012201210001000000000000012301210001000000000000012401210001000000000000012501210001000000000000012601210001000000000000012701210001000000000000012801210001000000000000012901210001000000000000012a01210001000000000000012b01210001000000000000012c01210001000000000000012d01210001000000000000012e01210001000000000000012f01210001000000000000013001210001000000000000013101210001000000000000013201210001000000000000013301210001000000000000013401210001000000000000013501210001000000000000013601210001000000000000013701210001000000000000013801210001000000000000013901210001000000000000013a01210001000000000000013b01210001000000000000013c01210001000000000000013d01210001000000000000013e01210001000000000000013f01210001000000000000014001210001000000000000014101210001000000000000014201210001000000000000014301210001000000000000014401210001000000000000014501210001000000000000014601210001000000000000014701210001000000000000014801210001000000000000014901210001000000000000014a01210001000000000000014b01210001000000000000014c01210001000000000000014d01210001000000000000014e01210001000000000000014f01210001000000000000015001210001000000000000015101210001000000000000015201210001000000000000015301210001000000000000015401210001000000000000015501210001000000000000015601210001000000000000015701210001000000000000015801210001000000000000015901210001000000000000015a01210001000000000000015b01210001000000000000015c01210001000000000000015d01210001000000000000015e01210001000000000000015f01210001000000000000016001210001000000000000016101210001000000000000016201210001000000000000016301210001000000000000016401210001000000000000016501210001000000000000016601210001000000000000016701210001000000000000016801210001000000000000016901210001000000000000016a01210001000000000000016b01210001000000000000016c01210001000000000000016d01210001000000000000016e01210001000000000000016f01210001000000000000017001210001000000000000017101210001000000000000017201210001000000000000017301210001000000000000017401210001000000000000017501210001000000000000017601210001000000000000017701210001000000000000017801210001000000000000017901210001000000000000017a01210001000000000000017b01210001000000000000017c01210001000000000000017d01210001000000000000017e01210001000000000000017f01210001000000000000018001210001000000000000018101210001000000000000018201210001000000000000018301210001000000000000018401210001000000000000018501210001000000000000018601210001000000000000018701210001000000000000018801210001000000000000018901210001000000000000018a01210001000000000000018b01210001000000000000018c01210001000000000000018d01210001000000000000018e01210001000000000000018f01210001000000000000019001210001000000000000019101210001000000000000019201210001000000000000019301210001000000000000019401210001000000000000019501210001000000000000019601210001000000000000019701210001000000000000019801210001000000000000019901210001000000000000019a01210001000000000000019b01210001000000000000019c01210001000000000000019d01210001000000000000019e01210001000000000000019f0121000100000000000001a00121000100000000000001a10121000100000000000001a20121000100000000000001a30121000100000000000001a40121000100000000000001a50121000100000000000001a60121000100000000000001a70121000100000000000001a80121000100000000000001a90121000100000000000001aa0121000100000000000001ab0121000100000000000001ac0121000100000000000001ad0121000100000000000001ae0121000100000000000001af0121000100000000000001b00121000100000000000001b10121000100000000000001b20121000100000000000001b30121000100000000000001b40121000100000000000001b50121000100000000000001b60121000100000000000001b70121000100000000000001b80121000100000000000001b90121000100000000000001ba0121000100000000000001bb0121000100000000000001bc0121000100000000000001bd0121000100000000000001be0121000100000000000001bf0121000100000000000001c00121000100000000000001c10121000100000000000001c20121000100000000000001c30121000100000000000001c40121000100000000000001c50121000100000000000001c60121000100000000000001c70121000100000000000001c80121000100000000000001c90121000100000000000001ca0121000100000000000001cb0121000100000000000001cc0121000100000000000001cd0121000100000000000001ce0121000100000000000001cf0121000100000000000001d00121000100000000000001d10121000100000000000001d20121000100000000000001d30121000100000000000001d40121000100000000000001d50121000100000000000001d60121000100000000000001d70121000100000000000001d80121000100000000000001d90121000100000000000001da0121000100000000000001db0121000100000000000001dc0121000100000000000001dd0121000100000000000001de0121000100000000000001df0121000100000000000001e00121000100000000000001e10121000100000000000001e20121000100000000000001e30121000100000000000001e40121000100000000000001e50121000100000000000001e60121000100000000000001e70121000100000000000001e80121000100000000000001e90121000100000000000001ea0121000100000000000001eb0121000100000000000001ec0121000100000000000001ed0121000100000000000001ee0121000100000000000001ef0121000100000000000001f00121000100000000000001f10121000100000000000001f20121000100000000000001f30121000100000000000001f40121000100000000000001f50121000100000000000001f60121000100000000000001f70121000100000000000001f80121000100000000000001f90121000100000000000001fa0121000100000000000001fb0121000100000000000001fc0121000100000000000001fd0121000100000000000001fe0121000100000000000001ff01210001000000000000020001210001000000000000020101210001000000000000020201210001000000000000020301210001000000000000020401210001000000000000020501210001000000000000020601210001000000000000020701210001000000000000020801210001000000000000020901210001000000000000020a01210001000000000000020b01210001000000000000020c01210001000000000000020d01210001000000000000020e01210001000000000000020f01210001000000000000021001210001000000000000021101210001000000000000021201210001000000000000021301210001000000000000021401210001000000000000021501210001000000000000021601210001000000000000021701210001000000000000021801210001000000000000021901210001000000000000021a01210001000000000000021b01210001000000000000021c01210001000000000000021d01210001000000000000021e01210001000000000000021f01210001000000000000022001210001000000000000022101210001000000000000022201210001000000000000022301210001000000000000022401210001000000000000022501210001000000000000022601210001000000000000022701210001000000000000022801210001000000000000022901210001000000000000022a01210001000000000000022b01210001000000000000022c01210001000000000000022d01210001000000000000022e01210001000000000000022f01210001000000000000023001210001000000000000023101210001000000000000023201210001000000000000023301210001000000000000023401210001000000000000023501210001000000000000023601210001000000000000023701210001000000000000023801210001000000000000023901210001000000000000023a01210001000000000000023b01210001000000000000023c01210001000000000000023d01210001000000000000023e01210001000000000000023f01210001000000000000024001210001000000000000024101210001000000000000024201210001000000000000024301210001000000000000024401210001000000000000024501210001000000000000024601210001000000000000024701210001000000000000024801210001000000000000024901210001000000000000024a01210001000000000000024b01210001000000000000024c01210001000000000000024d01210001000000000000024e01210001000000000000024f01210001000000000000025001210001000000000000025101210001000000000000025201210001000000000000025301210001000000000000025401210001000000000000025501210001000000000000025601210001000000000000025701210001000000000000025801210001000000000000025901210001000000000000025a01210001000000000000025b01210001000000000000025c01210001000000000000025d01210001000000000000025e01210001000000000000025f01210001000000000000026001210001000000000000026101210001000000000000026201210001000000000000026301210001000000000000026401210001000000000000026501210001000000000000026601210001000000000000026701210001000000000000026801210001000000000000026901210001000000000000026a01210001000000000000026b01210001000000000000026c01210001000000000000026d01210001000000000000026e01210001000000000000026f01210001000000000000027001210001000000000000027101210001000000000000027201210001000000000000027301210001000000000000027401210001000000000000027501210001000000000000027601210001000000000000027701210001000000000000027801210001000000000000027901210001000000000000027a01210001000000000000027b01210001000000000000027c01210001000000000000027d01210001000000000000027e01210001000000000000027f01210001000000000000028001210001000000000000028101210001000000000000028201210001000000000000028301210001000000000000028401210001000000000000028501210001000000000000028601210001000000000000028701210001000000000000028801210001000000000000028901210001000000000000028a01210001000000000000028b01210001000000000000028c01210001000000000000028d01210001000000000000028e01210001000000000000028f01210001000000000000029001210001000000000000029101210001000000000000029201210001000000000000029301210001000000000000029401210001000000000000029501210001000000000000029601210001000000000000029701210001000000000000029801210001000000000000029901210001000000000000029a01210001000000000000029b01210001000000000000029c01210001000000000000029d01210001000000000000029e01210001000000000000029f0121000100000000000002a00121000100000000000002a10121000100000000000002a20121000100000000000002a30121000100000000000002a40121000100000000000002a50121000100000000000002a60121000100000000000002a70121000100000000000002a80121000100000000000002a90121000100000000000002aa0121000100000000000002ab0121000100000000000002ac0121000100000000000002ad0121000100000000000002ae0121000100000000000002af0121000100000000000002b00121000100000000000002b10121000100000000000002b20121000100000000000002b30121000100000000000002b40121000100000000000002b50121000100000000000002b60121000100000000000002b70121000100000000000002b80121000100000000000002b90121000100000000000002ba0121000100000000000002bb0121000100000000000002bc0121000100000000000002bd0121000100000000000002be0121000100000000000002bf0121000100000000000002c00121000100000000000002c10121000100000000000002c20121000100000000000002c30121000100000000000002c40121000100000000000002c50121000100000000000002c60121000100000000000002c70121000100000000000002c80121000100000000000002c90121000100000000000002ca0121000100000000000002cb0121000100000000000002cc0121000100000000000002cd0121000100000000000002ce0121000100000000000002cf0121000100000000000002d00121000100000000000002d10121000100000000000002d20121000100000000000002d30121000100000000000002d40121000100000000000002d50121000100000000000002d60121000100000000000002d70121000100000000000002d80121000100000000000002d90121000100000000000002da0121000100000000000002db0121000100000000000002dc0121000100000000000002dd0121000100000000000002de0121000100000000000002df0121000100000000000002e00121000100000000000002e10121000100000000000002e20121000100000000000002e30121000100000000000002e40121000100000000000002e50121000100000000000002e60121000100000000000002e70121000100000000000002e80121000100000000000002e90121000100000000000002ea0121000100000000000002eb0121000100000000000002ec0121000100000000000002ed0121000100000000000002ee0121000100000000000002ef0121000100000000000002f00121000100000000000002f10121000100000000000002f20121000100000000000002f30121000100000000000002f40121000100000000000002f50121000100000000000002f60121000100000000000002f70121000100000000000002f80121000100000000000002f90121000100000000000002fa0121000100000000000002fb0121000100000000000002fc0121000100000000000002fd0121000100000000000002fe0121000100000000000002ff01210001000000000000030001210001000000000000030101210001000000000000030201210001000000000000030301210001000000000000030401210001000000000000030501210001000000000000030601210001000000000000030701210001000000000000030801210001000000000000030901210001000000000000030a01210001000000000000030b01210001000000000000030c01210001000000000000030d01210001000000000000030e01210001000000000000030f01210001000000000000031001210001000000000000031101210001000000000000031201210001000000000000031301210001000000000000031401210001000000000000031501210001000000000000031601210001000000000000031701210001000000000000031801210001000000000000031901210001000000000000031a01210001000000000000031b01210001000000000000031c01210001000000000000031d01210001000000000000031e01210001000000000000031f01210001000000000000032001210001000000000000032101210001000000000000032201210001000000000000032301210001000000000000032401210001000000000000032501210001000000000000032601210001000000000000032701210001000000000000032801210001000000000000032901210001000000000000032a01210001000000000000032b01210001000000000000032c01210001000000000000032d01210001000000000000032e01210001000000000000032f01210001000000000000033001210001000000000000033101210001000000000000033201210001000000000000033301210001000000000000033401210001000000000000033501210001000000000000033601210001000000000000033701210001000000000000033801210001000000000000033901210001000000000000033a01210001000000000000033b01210001000000000000033c01210001000000000000033d01210001000000000000033e01210001000000000000033f01210001000000000000034001210001000000000000034101210001000000000000034201210001000000000000034301210001000000000000034401210001000000000000034501210001000000000000034601210001000000000000034701210001000000000000034801210001000000000000034901210001000000000000034a01210001000000000000034b01210001000000000000034c01210001000000000000034d01210001000000000000034e01210001000000000000034f01210001000000000000035001210001000000000000035101210001000000000000035201210001000000000000035301210001000000000000035401210001000000000000035501210001000000000000035601210001000000000000035701210001000000000000035801210001000000000000035901210001000000000000035a01210001000000000000035b01210001000000000000035c01210001000000000000035d01210001000000000000035e01210001000000000000035f01210001000000000000036001210001000000000000036101210001000000000000036201210001000000000000036301210001000000000000036401210001000000000000036501210001000000000000036601210001000000000000036701210001000000000000036801210001000000000000036901210001000000000000036a01210001000000000000036b01210001000000000000036c01210001000000000000036d01210001000000000000036e01210001000000000000036f01210001000000000000037001210001000000000000037101210001000000000000037201210001000000000000037301210001000000000000037401210001000000000000037501210001000000000000037601210001000000000000037701210001000000000000037801210001000000000000037901210001000000000000037a01210001000000000000037b01210001000000000000037c01210001000000000000037d01210001000000000000037e01210001000000000000037f01210001000000000000038001210001000000000000038101210001000000000000038201210001000000000000038301210001000000000000038401210001000000000000038501210001000000000000038601210001000000000000038701210001000000000000038801210001000000000000038901210001000000000000038a01210001000000000000038b01210001000000000000038c01210001000000000000038d01210001000000000000038e01210001000000000000038f01210001000000000000039001210001000000000000039101210001000000000000039201210001000000000000039301210001000000000000039401210001000000000000039501210001000000000000039601210001000000000000039701210001000000000000039801210001000000000000039901210001000000000000039a01210001000000000000039b01210001000000000000039c01210001000000000000039d01210001000000000000039e01210001000000000000039f0121000100000000000003a00121000100000000000003a10121000100000000000003a20121000100000000000003a30121000100000000000003a40121000100000000000003a50121000100000000000003a60121000100000000000003a70121000100000000000003a80121000100000000000003a90121000100000000000003aa0121000100000000000003ab0121000100000000000003ac0121000100000000000003ad0121000100000000000003ae0121000100000000000003af0121000100000000000003b00121000100000000000003b10121000100000000000003b20121000100000000000003b30121000100000000000003b40121000100000000000003b50121000100000000000003b60121000100000000000003b70121000100000000000003b80121000100000000000003b90121000100000000000003ba0121000100000000000003bb0121000100000000000003bc0121000100000000000003bd0121000100000000000003be0121000100000000000003bf0121000100000000000003c00121000100000000000003c10121000100000000000003c20121000100000000000003c30121000100000000000003c40121000100000000000003c50121000100000000000003c60121000100000000000003c70121000100000000000003c80121000100000000000003c90121000100000000000003ca0121000100000000000003cb0121000100000000000003cc0121000100000000000003cd0121000100000000000003ce0121000100000000000003cf0121000100000000000003d00121000100000000000003d10121000100000000000003d20121000100000000000003d30121000100000000000003d40121000100000000000003d50121000100000000000003d60121000100000000000003d70121000100000000000003d80121000100000000000003d90121000100000000000003da0121000100000000000003db0121000100000000000003dc0121000100000000000003dd0121000100000000000003de0121000100000000000003df0121000100000000000003e00121000100000000000003e10121000100000000000003e20121000100000000000003e30121000100000000000003e40121000100000000000003e50121000100000000000003e60121000100000000000003e70121000100000000000003e80121000100000000000003e90121000100000000000003ea0121000100000000000003eb0121000100000000000003ec0121000100000000000003ed0121000100000000000003ee0121000100000000000003ef0121000100000000000003f00121000100000000000003f10121000100000000000003f20121000100000000000003f30121000100000000000003f40121000100000000000003f50121000100000000000003f60121000100000000000003f70121000100000000000003f80121000100000000000003f90121000100000000000003fa0121000100000000000003fb0121000100000000000003fc0121000100000000000003fd0121000100000000000003fe0121000100000000000003ff01210001000000000000040001210001000000000000040101210001000000000000040201210001000000000000040301210001000000000000040401210001000000000000040501210001000000000000040601210001000000000000040701210001000000000000040801210001000000000000040901210001000000000000040a01210001000000000000040b01210001000000000000040c01210001000000000000040d01210001000000000000040e01210001000000000000040f01210001000000000000041001210001000000000000041101210001000000000000041201210001000000000000041301210001000000000000041401210001000000000000041501210001000000000000041601210001000000000000041701210001000000000000041801210001000000000000041901210001000000000000041a01210001000000000000041b01210001000000000000041c01210001000000000000041d01210001000000000000041e01210001000000000000041f01210001000000000000042001210001000000000000042101210001000000000000042201210001000000000000042301210001000000000000042401210001000000000000042501210001000000000000042601210001000000000000042701210001000000000000042801210001000000000000042901210001000000000000042a01210001000000000000042b01210001000000000000042c01210001000000000000042d01210001000000000000042e01210001000000000000042f01210001000000000000043001210001000000000000043101210001000000000000043201210001000000000000043301210001000000000000043401210001000000000000043501210001000000000000043601210001000000000000043701210001000000000000043801210001000000000000043901210001000000000000043a01210001000000000000043b01210001000000000000043c01210001000000000000043d01210001000000000000043e01210001000000000000043f01210001000000000000044001210001000000000000044101210001000000000000044201210001000000000000044301210001000000000000044401210001000000000000044501210001000000000000044601210001000000000000044701210001000000000000044801210001000000000000044901210001000000000000044a01210001000000000000044b01210001000000000000044c01210001000000000000044d01210001000000000000044e01210001000000000000044f01210001000000000000045001210001000000000000045101210001000000000000045201210001000000000000045301210001000000000000045401210001000000000000045501210001000000000000045601210001000000000000045701210001000000000000045801210001000000000000045901210001000000000000045a01210001000000000000045b01210001000000000000045c01210001000000000000045d01210001000000000000045e01210001000000000000045f01210001000000000000046001210001000000000000046101210001000000000000046201210001000000000000046301210001000000000000046401210001000000000000046501210001000000000000046601210001000000000000046701210001000000000000046801210001000000000000046901210001000000000000046a01210001000000000000046b01210001000000000000046c01210001000000000000046d01210001000000000000046e01210001000000000000046f01210001000000000000047001210001000000000000047101210001000000000000047201210001000000000000047301210001000000000000047401210001000000000000047501210001000000000000047601210001000000000000047701210001000000000000047801210001000000000000047901210001000000000000047a01210001000000000000047b01210001000000000000047c01210001000000000000047d01210001000000000000047e01210001000000000000047f01210001000000000000048001210001000000000000048101210001000000000000048201210001000000000000048301210001000000000000048401210001000000000000048501210001000000000000048601210001000000000000048701210001000000000000048801210001000000000000048901210001000000000000048a01210001000000000000048b01210001000000000000048c01210001000000000000048d01210001000000000000048e01210001000000000000048f01210001000000000000049001210001000000000000049101210001000000000000049201210001000000000000049301210001000000000000049401210001000000000000049501210001000000000000049601210001000000000000049701210001000000000000049801210001000000000000049901210001000000000000049a01210001000000000000049b01210001000000000000049c01210001000000000000049d01210001000000000000049e01210001000000000000049f0121000100000000000004a00121000100000000000004a10121000100000000000004a20121000100000000000004a30121000100000000000004a40121000100000000000004a50121000100000000000004a60121000100000000000004a70121000100000000000004a80121000100000000000004a90121000100000000000004aa0121000100000000000004ab0121000100000000000004ac0121000100000000000004ad0121000100000000000004ae0121000100000000000004af0121000100000000000004b00121000100000000000004b10121000100000000000004b20121000100000000000004b30121000100000000000004b40121000100000000000004b50121000100000000000004b60121000100000000000004b70121000100000000000004b80121000100000000000004b90121000100000000000004ba0121000100000000000004bb0121000100000000000004bc0121000100000000000004bd0121000100000000000004be0121000100000000000004bf0121000100000000000004c00121000100000000000004c10121000100000000000004c20121000100000000000004c30121000100000000000004c40121000100000000000004c50121000100000000000004c60121000100000000000004c70121000100000000000004c80121000100000000000004c90121000100000000000004ca0121000100000000000004cb0121000100000000000004cc0121000100000000000004cd0121000100000000000004ce0121000100000000000004cf0121000100000000000004d00121000100000000000004d10121000100000000000004d20121000100000000000004d30121000100000000000004d40121000100000000000004d50121000100000000000004d60121000100000000000004d70121000100000000000004d80121000100000000000004d90121000100000000000004da0121000100000000000004db0121000100000000000004dc0121000100000000000004dd0121000100000000000004de0121000100000000000004df0121000100000000000004e00121000100000000000004e10121000100000000000004e20121000100000000000004e30121000100000000000004e40121000100000000000004e50121000100000000000004e60121000100000000000004e70121000100000000000004e80121000100000000000004e90121000100000000000004ea0121000100000000000004eb0121000100000000000004ec0121000100000000000004ed0121000100000000000004ee0121000100000000000004ef0121000100000000000004f00121000100000000000004f10121000100000000000004f20121000100000000000004f30121000100000000000004f40121000100000000000004f50121000100000000000004f60121000100000000000004f70121000100000000000004f80121000100000000000004f90121000100000000000004fa0121000100000000000004fb0121000100000000000004fc0121000100000000000004fd0121000100000000000004fe0121000100000000000004ff01210001000000000000050001210001000000000000050101210001000000000000050201210001000000000000050301210001000000000000050401210001000000000000050501210001000000000000050601210001000000000000050701210001000000000000050801210001000000000000050901210001000000000000050a01210001000000000000050b01210001000000000000050c01210001000000000000050d01210001000000000000050e01210001000000000000050f01210001000000000000051001210001000000000000051101210001000000000000051201210001000000000000051301210001000000000000051401210001000000000000051501210001000000000000051601210001000000000000051701210001000000000000051801210001000000000000051901210001000000000000051a01210001000000000000051b01210001000000000000051c01210001000000000000051d01210001000000000000051e01210001000000000000051f01210001000000000000052001210001000000000000052101210001000000000000052201210001000000000000052301210001000000000000052401210001000000000000052501210001000000000000052601210001000000000000052701210001000000000000052801210001000000000000052901210001000000000000052a01210001000000000000052b01210001000000000000052c01210001000000000000052d01210001000000000000052e01210001000000000000052f01210001000000000000053001210001000000000000053101210001000000000000053201210001000000000000053301210001000000000000053401210001000000000000053501210001000000000000053601210001000000000000053701210001000000000000053801210001000000000000053901210001000000000000053a01210001000000000000053b01210001000000000000053c01210001000000000000053d01210001000000000000053e01210001000000000000053f01210001000000000000054001210001000000000000054101210001000000000000054201210001000000000000054301210001000000000000054401210001000000000000054501210001000000000000054601210001000000000000054701210001000000000000054801210001000000000000054901210001000000000000054a01210001000000000000054b01210001000000000000054c01210001000000000000054d01210001000000000000054e01210001000000000000054f01210001000000000000055001210001000000000000055101210001000000000000055201210001000000000000055301210001000000000000055401210001000000000000055501210001000000000000055601210001000000000000055701210001000000000000055801210001000000000000055901210001000000000000055a01210001000000000000055b01210001000000000000055c01210001000000000000055d01210001000000000000055e01210001000000000000055f01210001000000000000056001210001000000000000056101210001000000000000056201210001000000000000056301210001000000000000056401210001000000000000056501210001000000000000056601210001000000000000056701210001000000000000056801210001000000000000056901210001000000000000056a01210001000000000000056b01210001000000000000056c01210001000000000000056d01210001000000000000056e01210001000000000000056f01210001000000000000057001210001000000000000057101210001000000000000057201210001000000000000057301210001000000000000057401210001000000000000057501210001000000000000057601210001000000000000057701210001000000000000057801210001000000000000057901210001000000000000057a01210001000000000000057b01210001000000000000057c01210001000000000000057d01210001000000000000057e01210001000000000000057f01210001000000000000058001210001000000000000058101210001000000000000058201210001000000000000058301210001000000000000058401210001000000000000058501210001000000000000058601210001000000000000058701210001000000000000058801210001000000000000058901210001000000000000058a01210001000000000000058b01210001000000000000058c01210001000000000000058d01210001000000000000058e01210001000000000000058f01210001000000000000059001210001000000000000059101210001000000000000059201210001000000000000059301210001000000000000059401210001000000000000059501210001000000000000059601210001000000000000059701210001000000000000059801210001000000000000059901210001000000000000059a01210001000000000000059b01210001000000000000059c01210001000000000000059d01210001000000000000059e01210001000000000000059f0121000100000000000005a00121000100000000000005a10121000100000000000005a20121000100000000000005a30121000100000000000005a40121000100000000000005a50121000100000000000005a60121000100000000000005a70121000100000000000005a80121000100000000000005a90121000100000000000005aa0121000100000000000005ab0121000100000000000005ac0121000100000000000005ad0121000100000000000005ae0121000100000000000005af0121000100000000000005b00121000100000000000005b10121000100000000000005b20121000100000000000005b30121000100000000000005b40121000100000000000005b50121000100000000000005b60121000100000000000005b70121000100000000000005b80121000100000000000005b90121000100000000000005ba0121000100000000000005bb0121000100000000000005bc0121000100000000000005bd0121000100000000000005be0121000100000000000005bf0121000100000000000005c00121000100000000000005c10121000100000000000005c20121000100000000000005c30121000100000000000005c40121000100000000000005c50121000100000000000005c60121000100000000000005c70121000100000000000005c80121000100000000000005c90121000100000000000005ca0121000100000000000005cb0121000100000000000005cc0121000100000000000005cd0121000100000000000005ce0121000100000000000005cf0121000100000000000005d00121000100000000000005d10121000100000000000005d20121000100000000000005d30121000100000000000005d40121000100000000000005d50121000100000000000005d60121000100000000000005d70121000100000000000005d80121000100000000000005d90121000100000000000005da0121000100000000000005db0121000100000000000005dc0121000100000000000005dd0121000100000000000005de0121000100000000000005df0121000100000000000005e00121000100000000000005e10121000100000000000005e20121000100000000000005e30121000100000000000005e40121000100000000000005e50121000100000000000005e60121000100000000000005e70121000100000000000005e80121000100000000000005e90121000100000000000005ea0121000100000000000005eb0121000100000000000005ec0121000100000000000005ed0121000100000000000005ee0121000100000000000005ef0121000100000000000005f00121000100000000000005f10121000100000000000005f20121000100000000000005f30121000100000000000005f40121000100000000000005f50121000100000000000005f60121000100000000000005f70121000100000000000005f80121000100000000000005f90121000100000000000005fa0121000100000000000005fb0121000100000000000005fc0121000100000000000005fd0121000100000000000005fe0121000100000000000005ff01210001000000000000060001210001000000000000060101210001000000000000060201210001000000000000060301210001000000000000060401210001000000000000060501210001000000000000060601210001000000000000060701210001000000000000060801210001000000000000060901210001000000000000060a01210001000000000000060b01210001000000000000060c01210001000000000000060d01210001000000000000060e01210001000000000000060f01210001000000000000061001210001000000000000061101210001000000000000061201210001000000000000061301210001000000000000061401210001000000000000061501210001000000000000061601210001000000000000061701210001000000000000061801210001000000000000061901210001000000000000061a01210001000000000000061b01210001000000000000061c01210001000000000000061d01210001000000000000061e01210001000000000000061f01210001000000000000062001210001000000000000062101210001000000000000062201210001000000000000062301210001000000000000062401210001000000000000062501210001000000000000062601210001000000000000062701210001000000000000062801210001000000000000062901210001000000000000062a01210001000000000000062b01210001000000000000062c01210001000000000000062d01210001000000000000062e01210001000000000000062f01210001000000000000063001210001000000000000063101210001000000000000063201210001000000000000063301210001000000000000063401210001000000000000063501210001000000000000063601210001000000000000063701210001000000000000063801210001000000000000063901210001000000000000063a01210001000000000000063b01210001000000000000063c01210001000000000000063d01210001000000000000063e01210001000000000000063f01210001000000000000064001210001000000000000064101210001000000000000064201210001000000000000064301210001000000000000064401210001000000000000064501210001000000000000064601210001000000000000064701210001000000000000064801210001000000000000064901210001000000000000064a01210001000000000000064b01210001000000000000064c01210001000000000000064d01210001000000000000064e01210001000000000000064f01210001000000000000065001210001000000000000065101210001000000000000065201210001000000000000065301210001000000000000065401210001000000000000065501210001000000000000065601210001000000000000065701210001000000000000065801210001000000000000065901210001000000000000065a01210001000000000000065b01210001000000000000065c01210001000000000000065d01210001000000000000065e01210001000000000000065f01210001000000000000066001210001000000000000066101210001000000000000066201210001000000000000066301210001000000000000066401210001000000000000066501210001000000000000066601210001000000000000066701210001000000000000066801210001000000000000066901210001000000000000066a01210001000000000000066b01210001000000000000066c01210001000000000000066d01210001000000000000066e01210001000000000000066f01210001000000000000067001210001000000000000067101210001000000000000067201210001000000000000067301210001000000000000067401210001000000000000067501210001000000000000067601210001000000000000067701210001000000000000067801210001000000000000067901210001000000000000067a01210001000000000000067b01210001000000000000067c01210001000000000000067d01210001000000000000067e01210001000000000000067f01210001000000000000068001210001000000000000068101210001000000000000068201210001000000000000068301210001000000000000068401210001000000000000068501210001000000000000068601210001000000000000068701210001000000000000068801210001000000000000068901210001000000000000068a01210001000000000000068b01210001000000000000068c01210001000000000000068d01210001000000000000068e01210001000000000000068f01210001000000000000069001210001000000000000069101210001000000000000069201210001000000000000069301210001000000000000069401210001000000000000069501210001000000000000069601210001000000000000069701210001000000000000069801210001000000000000069901210001000000000000069a01210001000000000000069b01210001000000000000069c01210001000000000000069d01210001000000000000069e01210001000000000000069f0121000100000000000006a00121000100000000000006a10121000100000000000006a20121000100000000000006a30121000100000000000006a40121000100000000000006a50121000100000000000006a60121000100000000000006a70121000100000000000006a80121000100000000000006a90121000100000000000006aa0121000100000000000006ab0121000100000000000006ac0121000100000000000006ad0121000100000000000006ae0121000100000000000006af0121000100000000000006b00121000100000000000006b10121000100000000000006b20121000100000000000006b30121000100000000000006b40121000100000000000006b50121000100000000000006b60121000100000000000006b70121000100000000000006b80121000100000000000006b90121000100000000000006ba0121000100000000000006bb0121000100000000000006bc0121000100000000000006bd0121000100000000000006be0121000100000000000006bf0121000100000000000006c00121000100000000000006c10121000100000000000006c20121000100000000000006c30121000100000000000006c40121000100000000000006c50121000100000000000006c60121000100000000000006c70121000100000000000006c80121000100000000000006c90121000100000000000006ca0121000100000000000006cb0121000100000000000006cc0121000100000000000006cd0121000100000000000006ce0121000100000000000006cf0121000100000000000006d00121000100000000000006d10121000100000000000006d20121000100000000000006d30121000100000000000006d40121000100000000000006d50121000100000000000006d60121000100000000000006d70121000100000000000006d80121000100000000000006d90121000100000000000006da0121000100000000000006db0121000100000000000006dc0121000100000000000006dd0121000100000000000006de0121000100000000000006df0121000100000000000006e00121000100000000000006e10121000100000000000006e20121000100000000000006e30121000100000000000006e40121000100000000000006e50121000100000000000006e60121000100000000000006e70121000100000000000006e80121000100000000000006e90121000100000000000006ea0121000100000000000006eb0121000100000000000006ec0121000100000000000006ed0121000100000000000006ee0121000100000000000006ef0121000100000000000006f00121000100000000000006f10121000100000000000006f20121000100000000000006f30121000100000000000006f40121000100000000000006f50121000100000000000006f60121000100000000000006f70121000100000000000006f80121000100000000000006f90121000100000000000006fa0121000100000000000006fb0121000100000000000006fc0121000100000000000006fd0121000100000000000006fe0121000100000000000006ff01210001000000000000070001210001000000000000070101210001000000000000070201210001000000000000070301210001000000000000070401210001000000000000070501210001000000000000070601210001000000000000070701210001000000000000070801210001000000000000070901210001000000000000070a01210001000000000000070b01210001000000000000070c01210001000000000000070d01210001000000000000070e01210001000000000000070f01210001000000000000071001210001000000000000071101210001000000000000071201210001000000000000071301210001000000000000071401210001000000000000071501210001000000000000071601210001000000000000071701210001000000000000071801210001000000000000071901210001000000000000071a01210001000000000000071b01210001000000000000071c01210001000000000000071d01210001000000000000071e01210001000000000000071f01210001000000000000072001210001000000000000072101210001000000000000072201210001000000000000072301210001000000000000072401210001000000000000072501210001000000000000072601210001000000000000072701210001000000000000072801210001000000000000072901210001000000000000072a01210001000000000000072b01210001000000000000072c01210001000000000000072d01210001000000000000072e01210001000000000000072f01210001000000000000073001210001000000000000073101210001000000000000073201210001000000000000073301210001000000000000073401210001000000000000073501210001000000000000073601210001000000000000073701210001000000000000073801210001000000000000073901210001000000000000073a01210001000000000000073b01210001000000000000073c01210001000000000000073d01210001000000000000073e01210001000000000000073f01210001000000000000074001210001000000000000074101210001000000000000074201210001000000000000074301210001000000000000074401210001000000000000074501210001000000000000074601210001000000000000074701210001000000000000074801210001000000000000074901210001000000000000074a01210001000000000000074b01210001000000000000074c01210001000000000000074d01210001000000000000074e01210001000000000000074f01210001000000000000075001210001000000000000075101210001000000000000075201210001000000000000075301210001000000000000075401210001000000000000075501210001000000000000075601210001000000000000075701210001000000000000075801210001000000000000075901210001000000000000075a01210001000000000000075b01210001000000000000075c01210001000000000000075d01210001000000000000075e01210001000000000000075f01210001000000000000076001210001000000000000076101210001000000000000076201210001000000000000076301210001000000000000076401210001000000000000076501210001000000000000076601210001000000000000076701210001000000000000076801210001000000000000076901210001000000000000076a01210001000000000000076b01210001000000000000076c01210001000000000000076d01210001000000000000076e01210001000000000000076f01210001000000000000077001210001000000000000077101210001000000000000077201210001000000000000077301210001000000000000077401210001000000000000077501210001000000000000077601210001000000000000077701210001000000000000077801210001000000000000077901210001000000000000077a01210001000000000000077b01210001000000000000077c01210001000000000000077d01210001000000000000077e01210001000000000000077f01210001000000000000078001210001000000000000078101210001000000000000078201210001000000000000078301210001000000000000078401210001000000000000078501210001000000000000078601210001000000000000078701210001000000000000078801210001000000000000078901210001000000000000078a01210001000000000000078b01210001000000000000078c01210001000000000000078d01210001000000000000078e01210001000000000000078f01210001000000000000079001210001000000000000079101210001000000000000079201210001000000000000079301210001000000000000079401210001000000000000079501210001000000000000079601210001000000000000079701210001000000000000079801210001000000000000079901210001000000000000079a01210001000000000000079b01210001000000000000079c01210001000000000000079d01210001000000000000079e01210001000000000000079f0121000100000000000007a00121000100000000000007a10121000100000000000007a20121000100000000000007a30121000100000000000007a40121000100000000000007a50121000100000000000007a60121000100000000000007a70121000100000000000007a80121000100000000000007a90121000100000000000007aa0121000100000000000007ab0121000100000000000007ac0121000100000000000007ad0121000100000000000007ae0121000100000000000007af0121000100000000000007b00121000100000000000007b10121000100000000000007b20121000100000000000007b30121000100000000000007b40121000100000000000007b50121000100000000000007b60121000100000000000007b70121000100000000000007b80121000100000000000007b90121000100000000000007ba0121000100000000000007bb0121000100000000000007bc0121000100000000000007bd0121000100000000000007be0121000100000000000007bf0121000100000000000007c00121000100000000000007c10121000100000000000007c20121000100000000000007c30121000100000000000007c40121000100000000000007c50121000100000000000007c60121000100000000000007c70121000100000000000007c80121000100000000000007c90121000100000000000007ca0121000100000000000007cb0121000100000000000007cc0121000100000000000007cd0121000100000000000007ce0121000100000000000007cf0121000100000000000007d00121000100000000000007d10121000100000000000007d20121000100000000000007d30121000100000000000007d40121000100000000000007d50121000100000000000007d60121000100000000000007d70121000100000000000007d80121000100000000000007d90121000100000000000007da0121000100000000000007db0121000100000000000007dc0121000100000000000007dd0121000100000000000007de0121000100000000000007df0121000100000000000007e00121000100000000000007e10121000100000000000007e20121000100000000000007e30121000100000000000007e40121000100000000000007e50121000100000000000007e60121000100000000000007e70121000100000000000007e80121000100000000000007e90121000100000000000007ea0121000100000000000007eb0121000100000000000007ec0121000100000000000007ed0121000100000000000007ee0121000100000000000007ef0121000100000000000007f00121000100000000000007f10121000100000000000007f20121000100000000000007f30121000100000000000007f40121000100000000000007f50121000100000000000007f60121000100000000000007f70121000100000000000007f80121000100000000000007f90121000100000000000007fa0121000100000000000007fb0121000100000000000007fc0121000100000000000007fd0121000100000000000007fe0121000100000000000007ff01210001000000000000080001210001000000000000080101210001000000000000080201210001000000000000080301210001000000000000080401210001000000000000080501210001000000000000080601210001000000000000080701210001000000000000080801210001000000000000080901210001000000000000080a01210001000000000000080b01210001000000000000080c01210001000000000000080d01210001000000000000080e01210001000000000000080f01210001000000000000081001210001000000000000081101210001000000000000081201210001000000000000081301210001000000000000081401210001000000000000081501210001000000000000081601210001000000000000081701210001000000000000081801210001000000000000081901210001000000000000081a01210001000000000000081b01210001000000000000081c01210001000000000000081d01210001000000000000081e01210001000000000000081f01210001000000000000082001210001000000000000082101210001000000000000082201210001000000000000082301210001000000000000082401210001000000000000082501210001000000000000082601210001000000000000082701210001000000000000082801210001000000000000082901210001000000000000082a01210001000000000000082b01210001000000000000082c01210001000000000000082d01210001000000000000082e01210001000000000000082f01210001000000000000083001210001000000000000083101210001000000000000083201210001000000000000083301210001000000000000083401210001000000000000083501210001000000000000083601210001000000000000083701210001000000000000083801210001000000000000083901210001000000000000083a01210001000000000000083b01210001000000000000083c01210001000000000000083d01210001000000000000083e01210001000000000000083f01210001000000000000084001210001000000000000084101210001000000000000084201210001000000000000084301210001000000000000084401210001000000000000084501210001000000000000084601210001000000000000084701210001000000000000084801210001000000000000084901210001000000000000084a01210001000000000000084b01210001000000000000084c01210001000000000000084d01210001000000000000084e01210001000000000000084f01210001000000000000085001210001000000000000085101210001000000000000085201210001000000000000085301210001000000000000085401210001000000000000085501210001000000000000085601210001000000000000085701210001000000000000085801210001000000000000085901210001000000000000085a01210001000000000000085b01210001000000000000085c01210001000000000000085d01210001000000000000085e01210001000000000000085f01210001000000000000086001210001000000000000086101210001000000000000086201210001000000000000086301210001000000000000086401210001000000000000086501210001000000000000086601210001000000000000086701210001000000000000086801210001000000000000086901210001000000000000086a01210001000000000000086b01210001000000000000086c01210001000000000000086d01210001000000000000086e01210001000000000000086f01210001000000000000087001210001000000000000087101210001000000000000087201210001000000000000087301210001000000000000087401210001000000000000087501210001000000000000087601210001000000000000087701210001000000000000087801210001000000000000087901210001000000000000087a01210001000000000000087b01210001000000000000087c01210001000000000000087d01210001000000000000087e01210001000000000000087f01210001000000000000088001210001000000000000088101210001000000000000088201210001000000000000088301210001000000000000088401210001000000000000088501210001000000000000088601210001000000000000088701210001000000000000088801210001000000000000088901210001000000000000088a01210001000000000000088b01210001000000000000088c01210001000000000000088d01210001000000000000088e01210001000000000000088f01210001000000000000089001210001000000000000089101210001000000000000089201210001000000000000089301210001000000000000089401210001000000000000089501210001000000000000089601210001000000000000089701210001000000000000089801210001000000000000089901210001000000000000089a01210001000000000000089b01210001000000000000089c01210001000000000000089d01210001000000000000089e01210001000000000000089f0121000100000000000008a00121000100000000000008a10121000100000000000008a20121000100000000000008a30121000100000000000008a40121000100000000000008a50121000100000000000008a60121000100000000000008a70121000100000000000008a80121000100000000000008a90121000100000000000008aa0121000100000000000008ab0121000100000000000008ac0121000100000000000008ad0121000100000000000008ae0121000100000000000008af0121000100000000000008b00121000100000000000008b10121000100000000000008b20121000100000000000008b30121000100000000000008b40121000100000000000008b50121000100000000000008b60121000100000000000008b70121000100000000000008b80121000100000000000008b90121000100000000000008ba0121000100000000000008bb0121000100000000000008bc0121000100000000000008bd0121000100000000000008be0121000100000000000008bf0121000100000000000008c00121000100000000000008c10121000100000000000008c20121000100000000000008c30121000100000000000008c40121000100000000000008c50121000100000000000008c60121000100000000000008c70121000100000000000008c80121000100000000000008c90121000100000000000008ca0121000100000000000008cb0121000100000000000008cc0121000100000000000008cd0121000100000000000008ce0121000100000000000008cf0121000100000000000008d00121000100000000000008d10121000100000000000008d20121000100000000000008d30121000100000000000008d40121000100000000000008d50121000100000000000008d60121000100000000000008d70121000100000000000008d80121000100000000000008d90121000100000000000008da0121000100000000000008db0121000100000000000008dc0121000100000000000008dd0121000100000000000008de0121000100000000000008df0121000100000000000008e00121000100000000000008e10121000100000000000008e20121000100000000000008e30121000100000000000008e40121000100000000000008e50121000100000000000008e60121000100000000000008e70121000100000000000008e80121000100000000000008e90121000100000000000008ea0121000100000000000008eb0121000100000000000008ec0121000100000000000008ed0121000100000000000008ee0121000100000000000008ef0121000100000000000008f00121000100000000000008f10121000100000000000008f20121000100000000000008f30121000100000000000008f40121000100000000000008f50121000100000000000008f60121000100000000000008f70121000100000000000008f80121000100000000000008f90121000100000000000008fa0121000100000000000008fb0121000100000000000008fc0121000100000000000008fd0121000100000000000008fe0121000100000000000008ff01210001000000000000090001210001000000000000090101210001000000000000090201210001000000000000090301210001000000000000090401210001000000000000090501210001000000000000090601210001000000000000090701210001000000000000090801210001000000000000090901210001000000000000090a01210001000000000000090b01210001000000000000090c01210001000000000000090d01210001000000000000090e01210001000000000000090f01210001000000000000091001210001000000000000091101210001000000000000091201210001000000000000091301210001000000000000091401210001000000000000091501210001000000000000091601210001000000000000091701210001000000000000091801210001000000000000091901210001000000000000091a01210001000000000000091b01210001000000000000091c01210001000000000000091d01210001000000000000091e01210001000000000000091f01210001000000000000092001210001000000000000092101210001000000000000092201210001000000000000092301210001000000000000092401210001000000000000092501210001000000000000092601210001000000000000092701210001000000000000092801210001000000000000092901210001000000000000092a01210001000000000000092b01210001000000000000092c01210001000000000000092d01210001000000000000092e01210001000000000000092f01210001000000000000093001210001000000000000093101210001000000000000093201210001000000000000093301210001000000000000093401210001000000000000093501210001000000000000093601210001000000000000093701210001000000000000093801210001000000000000093901210001000000000000093a01210001000000000000093b01210001000000000000093c01210001000000000000093d01210001000000000000093e01210001000000000000093f01210001000000000000094001210001000000000000094101210001000000000000094201210001000000000000094301210001000000000000094401210001000000000000094501210001000000000000094601210001000000000000094701210001000000000000094801210001000000000000094901210001000000000000094a01210001000000000000094b01210001000000000000094c01210001000000000000094d01210001000000000000094e01210001000000000000094f01210001000000000000095001210001000000000000095101210001000000000000095201210001000000000000095301210001000000000000095401210001000000000000095501210001000000000000095601210001000000000000095701210001000000000000095801210001000000000000095901210001000000000000095a01210001000000000000095b01210001000000000000095c01210001000000000000095d01210001000000000000095e01210001000000000000095f01210001000000000000096001210001000000000000096101210001000000000000096201210001000000000000096301210001000000000000096401210001000000000000096501210001000000000000096601210001000000000000096701210001000000000000096801210001000000000000096901210001000000000000096a01210001000000000000096b01210001000000000000096c01210001000000000000096d01210001000000000000096e01210001000000000000096f01210001000000000000097001210001000000000000097101210001000000000000097201210001000000000000097301210001000000000000097401210001000000000000097501210001000000000000097601210001000000000000097701210001000000000000097801210001000000000000097901210001000000000000097a01210001000000000000097b01210001000000000000097c01210001000000000000097d01210001000000000000097e01210001000000000000097f01210001000000000000098001210001000000000000098101210001000000000000098201210001000000000000098301210001000000000000098401210001000000000000098501210001000000000000098601210001000000000000098701210001000000000000098801210001000000000000098901210001000000000000098a01210001000000000000098b01210001000000000000098c01210001000000000000098d01210001000000000000098e01210001000000000000098f01210001000000000000099001210001000000000000099101210001000000000000099201210001000000000000099301210001000000000000099401210001000000000000099501210001000000000000099601210001000000000000099701210001000000000000099801210001000000000000099901210001000000000000099a01210001000000000000099b01210001000000000000099c01210001000000000000099d01210001000000000000099e01210001000000000000099f0121000100000000000009a00121000100000000000009a10121000100000000000009a20121000100000000000009a30121000100000000000009a40121000100000000000009a50121000100000000000009a60121000100000000000009a70121000100000000000009a80121000100000000000009a90121000100000000000009aa0121000100000000000009ab0121000100000000000009ac0121000100000000000009ad0121000100000000000009ae0121000100000000000009af0121000100000000000009b00121000100000000000009b10121000100000000000009b20121000100000000000009b30121000100000000000009b40121000100000000000009b50121000100000000000009b60121000100000000000009b70121000100000000000009b80121000100000000000009b90121000100000000000009ba0121000100000000000009bb0121000100000000000009bc0121000100000000000009bd0121000100000000000009be0121000100000000000009bf0121000100000000000009c00121000100000000000009c10121000100000000000009c20121000100000000000009c30121000100000000000009c40121000100000000000009c50121000100000000000009c60121000100000000000009c70121000100000000000009c80121000100000000000009c90121000100000000000009ca0121000100000000000009cb0121000100000000000009cc0121000100000000000009cd0121000100000000000009ce0121000100000000000009cf0121000100000000000009d00121000100000000000009d10121000100000000000009d20121000100000000000009d30121000100000000000009d40121000100000000000009d50121000100000000000009d60121000100000000000009d70121000100000000000009d80121000100000000000009d90121000100000000000009da0121000100000000000009db0121000100000000000009dc0121000100000000000009dd0121000100000000000009de0121000100000000000009df0121000100000000000009e00121000100000000000009e10121000100000000000009e20121000100000000000009e30121000100000000000009e40121000100000000000009e50121000100000000000009e60121000100000000000009e70121000100000000000009e80121000100000000000009e90121000100000000000009ea0121000100000000000009eb0121000100000000000009ec0121000100000000000009ed0121000100000000000009ee0121000100000000000009ef0121000100000000000009f00121000100000000000009f10121000100000000000009f20121000100000000000009f30121000100000000000009f40121000100000000000009f50121000100000000000009f60121000100000000000009f70121000100000000000009f80121000100000000000009f90121000100000000000009fa0121000100000000000009fb0121000100000000000009fc0121000100000000000009fd0121000100000000000009fe0121000100000000000009ff012100010000000000000a00012100010000000000000a01012100010000000000000a02012100010000000000000a03012100010000000000000a04012100010000000000000a05012100010000000000000a06012100010000000000000a07012100010000000000000a08012100010000000000000a09012100010000000000000a0a012100010000000000000a0b012100010000000000000a0c012100010000000000000a0d012100010000000000000a0e012100010000000000000a0f012100010000000000000a10012100010000000000000a11012100010000000000000a12012100010000000000000a13012100010000000000000a14012100010000000000000a15012100010000000000000a16012100010000000000000a17012100010000000000000a18012100010000000000000a19012100010000000000000a1a012100010000000000000a1b012100010000000000000a1c012100010000000000000a1d012100010000000000000a1e012100010000000000000a1f012100010000000000000a20012100010000000000000a21012100010000000000000a22012100010000000000000a23012100010000000000000a24012100010000000000000a25012100010000000000000a26012100010000000000000a27012100010000000000000a28012100010000000000000a29012100010000000000000a2a012100010000000000000a2b012100010000000000000a2c012100010000000000000a2d012100010000000000000a2e012100010000000000000a2f012100010000000000000a30012100010000000000000a31012100010000000000000a32012100010000000000000a33012100010000000000000a34012100010000000000000a35012100010000000000000a36012100010000000000000a37012100010000000000000a38012100010000000000000a39012100010000000000000a3a012100010000000000000a3b012100010000000000000a3c012100010000000000000a3d012100010000000000000a3e012100010000000000000a3f012100010000000000000a40012100010000000000000a41012100010000000000000a42012100010000000000000a43012100010000000000000a44012100010000000000000a45012100010000000000000a46012100010000000000000a47012100010000000000000a48012100010000000000000a49012100010000000000000a4a012100010000000000000a4b012100010000000000000a4c012100010000000000000a4d012100010000000000000a4e012100010000000000000a4f012100010000000000000a50012100010000000000000a51012100010000000000000a52012100010000000000000a53012100010000000000000a54012100010000000000000a55012100010000000000000a56012100010000000000000a57012100010000000000000a58012100010000000000000a59012100010000000000000a5a012100010000000000000a5b012100010000000000000a5c012100010000000000000a5d012100010000000000000a5e012100010000000000000a5f012100010000000000000a60012100010000000000000a61012100010000000000000a62012100010000000000000a63012100010000000000000a64012100010000000000000a65012100010000000000000a66012100010000000000000a67012100010000000000000a68012100010000000000000a69012100010000000000000a6a012100010000000000000a6b012100010000000000000a6c012100010000000000000a6d012100010000000000000a6e012100010000000000000a6f012100010000000000000a70012100010000000000000a71012100010000000000000a72012100010000000000000a73012100010000000000000a74012100010000000000000a75012100010000000000000a76012100010000000000000a77012100010000000000000a78012100010000000000000a79012100010000000000000a7a012100010000000000000a7b012100010000000000000a7c012100010000000000000a7d012100010000000000000a7e012100010000000000000a7f012100010000000000000a80012100010000000000000a81012100010000000000000a82012100010000000000000a83012100010000000000000a84012100010000000000000a85012100010000000000000a86012100010000000000000a87012100010000000000000a88012100010000000000000a89012100010000000000000a8a012100010000000000000a8b012100010000000000000a8c012100010000000000000a8d012100010000000000000a8e012100010000000000000a8f012100010000000000000a90012100010000000000000a91012100010000000000000a92012100010000000000000a93012100010000000000000a94012100010000000000000a95012100010000000000000a96012100010000000000000a97012100010000000000000a98012100010000000000000a99012100010000000000000a9a012100010000000000000a9b012100010000000000000a9c012100010000000000000a9d012100010000000000000a9e012100010000000000000a9f012100010000000000000aa0012100010000000000000aa1012100010000000000000aa2012100010000000000000aa3012100010000000000000aa4012100010000000000000aa5012100010000000000000aa6012100010000000000000aa7012100010000000000000aa8012100010000000000000aa9012100010000000000000aaa012100010000000000000aab012100010000000000000aac012100010000000000000aad012100010000000000000aae012100010000000000000aaf012100010000000000000ab0012100010000000000000ab1012100010000000000000ab2012100010000000000000ab3012100010000000000000ab4012100010000000000000ab5012100010000000000000ab6012100010000000000000ab7012100010000000000000ab8012100010000000000000ab9012100010000000000000aba012100010000000000000abb012100010000000000000abc012100010000000000000abd012100010000000000000abe012100010000000000000abf012100010000000000000ac0012100010000000000000ac1012100010000000000000ac2012100010000000000000ac3012100010000000000000ac4012100010000000000000ac5012100010000000000000ac6012100010000000000000ac7012100010000000000000ac8012100010000000000000ac9012100010000000000000aca012100010000000000000acb012100010000000000000acc012100010000000000000acd012100010000000000000ace012100010000000000000acf012100010000000000000ad0012100010000000000000ad1012100010000000000000ad2012100010000000000000ad3012100010000000000000ad4012100010000000000000ad5012100010000000000000ad6012100010000000000000ad7012100010000000000000ad8012100010000000000000ad9012100010000000000000ada012100010000000000000adb012100010000000000000adc012100010000000000000add012100010000000000000ade012100010000000000000adf012100010000000000000ae0012100010000000000000ae1012100010000000000000ae2012100010000000000000ae3012100010000000000000ae4012100010000000000000ae5012100010000000000000ae6012100010000000000000ae7012100010000000000000ae8012100010000000000000ae9012100010000000000000aea012100010000000000000aeb012100010000000000000aec012100010000000000000aed012100010000000000000aee012100010000000000000aef012100010000000000000af0012100010000000000000af1012100010000000000000af2012100010000000000000af3012100010000000000000af4012100010000000000000af5012100010000000000000af6012100010000000000000af7012100010000000000000af8012100010000000000000af9012100010000000000000afa012100010000000000000afb012100010000000000000afc012100010000000000000afd012100010000000000000afe012100010000000000000aff012100010000000000000b00012100010000000000000b01012100010000000000000b02012100010000000000000b03012100010000000000000b04012100010000000000000b05012100010000000000000b06012100010000000000000b07012100010000000000000b08012100010000000000000b09012100010000000000000b0a012100010000000000000b0b012100010000000000000b0c012100010000000000000b0d012100010000000000000b0e012100010000000000000b0f012100010000000000000b10012100010000000000000b11012100010000000000000b12012100010000000000000b13012100010000000000000b14012100010000000000000b15012100010000000000000b16012100010000000000000b17012100010000000000000b18012100010000000000000b19012100010000000000000b1a012100010000000000000b1b012100010000000000000b1c012100010000000000000b1d012100010000000000000b1e012100010000000000000b1f012100010000000000000b20012100010000000000000b21012100010000000000000b22012100010000000000000b23012100010000000000000b24012100010000000000000b25012100010000000000000b26012100010000000000000b27012100010000000000000b28012100010000000000000b29012100010000000000000b2a012100010000000000000b2b012100010000000000000b2c012100010000000000000b2d012100010000000000000b2e012100010000000000000b2f012100010000000000000b30012100010000000000000b31012100010000000000000b32012100010000000000000b33012100010000000000000b34012100010000000000000b35012100010000000000000b36012100010000000000000b37012100010000000000000b38012100010000000000000b39012100010000000000000b3a012100010000000000000b3b012100010000000000000b3c012100010000000000000b3d012100010000000000000b3e012100010000000000000b3f012100010000000000000b40012100010000000000000b41012100010000000000000b42012100010000000000000b43012100010000000000000b44012100010000000000000b45012100010000000000000b46012100010000000000000b47012100010000000000000b48012100010000000000000b49012100010000000000000b4a012100010000000000000b4b012100010000000000000b4c012100010000000000000b4d012100010000000000000b4e012100010000000000000b4f012100010000000000000b50012100010000000000000b51012100010000000000000b52012100010000000000000b53012100010000000000000b54012100010000000000000b55012100010000000000000b56012100010000000000000b57012100010000000000000b58012100010000000000000b59012100010000000000000b5a012100010000000000000b5b012100010000000000000b5c012100010000000000000b5d012100010000000000000b5e012100010000000000000b5f012100010000000000000b60012100010000000000000b61012100010000000000000b62012100010000000000000b63012100010000000000000b64012100010000000000000b65012100010000000000000b66012100010000000000000b67012100010000000000000b68012100010000000000000b69012100010000000000000b6a012100010000000000000b6b012100010000000000000b6c012100010000000000000b6d012100010000000000000b6e012100010000000000000b6f012100010000000000000b70012100010000000000000b71012100010000000000000b72012100010000000000000b73012100010000000000000b74012100010000000000000b75012100010000000000000b76012100010000000000000b77012100010000000000000b78012100010000000000000b79012100010000000000000b7a012100010000000000000b7b012100010000000000000b7c012100010000000000000b7d012100010000000000000b7e012100010000000000000b7f012100010000000000000b80012100010000000000000b81012100010000000000000b82012100010000000000000b83012100010000000000000b84012100010000000000000b85012100010000000000000b86012100010000000000000b87012100010000000000000b88012100010000000000000b89012100010000000000000b8a012100010000000000000b8b012100010000000000000b8c012100010000000000000b8d012100010000000000000b8e012100010000000000000b8f012100010000000000000b90012100010000000000000b91012100010000000000000b92012100010000000000000b93012100010000000000000b94012100010000000000000b95012100010000000000000b96012100010000000000000b97012100010000000000000b98012100010000000000000b99012100010000000000000b9a012100010000000000000b9b012100010000000000000b9c012100010000000000000b9d012100010000000000000b9e012100010000000000000b9f012100010000000000000ba0012100010000000000000ba1012100010000000000000ba2012100010000000000000ba3012100010000000000000ba4012100010000000000000ba5012100010000000000000ba6012100010000000000000ba7012100010000000000000ba8012100010000000000000ba9012100010000000000000baa012100010000000000000bab012100010000000000000bac012100010000000000000bad012100010000000000000bae012100010000000000000baf012100010000000000000bb0012100010000000000000bb1012100010000000000000bb2012100010000000000000bb3012100010000000000000bb4012100010000000000000bb5012100010000000000000bb6012100010000000000000bb7012100010000000000000bb8012100010000000000000bb9012100010000000000000bba012100010000000000000bbb012100010000000000000bbc012100010000000000000bbd012100010000000000000bbe012100010000000000000bbf012100010000000000000bc0012100010000000000000bc1012100010000000000000bc2012100010000000000000bc3012100010000000000000bc4012100010000000000000bc5012100010000000000000bc6012100010000000000000bc7012100010000000000000bc8012100010000000000000bc9012100010000000000000bca012100010000000000000bcb012100010000000000000bcc012100010000000000000bcd012100010000000000000bce012100010000000000000bcf012100010000000000000bd0012100010000000000000bd1012100010000000000000bd2012100010000000000000bd3012100010000000000000bd4012100010000000000000bd5012100010000000000000bd6012100010000000000000bd7012100010000000000000bd8012100010000000000000bd9012100010000000000000bda012100010000000000000bdb012100010000000000000bdc012100010000000000000bdd012100010000000000000bde012100010000000000000bdf012100010000000000000be0012100010000000000000be1012100010000000000000be2012100010000000000000be3012100010000000000000be4012100010000000000000be5012100010000000000000be6012100010000000000000be7012100010000000000000be8012100010000000000000be9012100010000000000000bea012100010000000000000beb012100010000000000000bec012100010000000000000bed012100010000000000000bee012100010000000000000bef012100010000000000000bf0012100010000000000000bf1012100010000000000000bf2012100010000000000000bf3012100010000000000000bf4012100010000000000000bf5012100010000000000000bf6012100010000000000000bf7012100010000000000000bf8012100010000000000000bf9012100010000000000000bfa012100010000000000000bfb012100010000000000000bfc012100010000000000000bfd012100010000000000000bfe012100010000000000000bff012100010000000000000c00012100010000000000000c01012100010000000000000c02012100010000000000000c03012100010000000000000c04012100010000000000000c05012100010000000000000c06012100010000000000000c07012100010000000000000c08012100010000000000000c09012100010000000000000c0a012100010000000000000c0b012100010000000000000c0c012100010000000000000c0d012100010000000000000c0e012100010000000000000c0f012100010000000000000c10012100010000000000000c11012100010000000000000c12012100010000000000000c13012100010000000000000c14012100010000000000000c15012100010000000000000c16012100010000000000000c17012100010000000000000c18012100010000000000000c19012100010000000000000c1a012100010000000000000c1b012100010000000000000c1c012100010000000000000c1d012100010000000000000c1e012100010000000000000c1f012100010000000000000c20012100010000000000000c21012100010000000000000c22012100010000000000000c23012100010000000000000c24012100010000000000000c25012100010000000000000c26012100010000000000000c27012100010000000000000c28012100010000000000000c29012100010000000000000c2a012100010000000000000c2b012100010000000000000c2c012100010000000000000c2d012100010000000000000c2e012100010000000000000c2f012100010000000000000c30012100010000000000000c31012100010000000000000c32012100010000000000000c33012100010000000000000c34012100010000000000000c35012100010000000000000c36012100010000000000000c37012100010000000000000c38012100010000000000000c39012100010000000000000c3a012100010000000000000c3b012100010000000000000c3c012100010000000000000c3d012100010000000000000c3e012100010000000000000c3f012100010000000000000c40012100010000000000000c41012100010000000000000c42012100010000000000000c43012100010000000000000c44012100010000000000000c45012100010000000000000c46012100010000000000000c47012100010000000000000c48012100010000000000000c49012100010000000000000c4a012100010000000000000c4b012100010000000000000c4c012100010000000000000c4d012100010000000000000c4e012100010000000000000c4f012100010000000000000c50012100010000000000000c51012100010000000000000c52012100010000000000000c53012100010000000000000c54012100010000000000000c55012100010000000000000c56012100010000000000000c57012100010000000000000c58012100010000000000000c59012100010000000000000c5a012100010000000000000c5b012100010000000000000c5c012100010000000000000c5d012100010000000000000c5e012100010000000000000c5f012100010000000000000c60012100010000000000000c61012100010000000000000c62012100010000000000000c63012100010000000000000c64012100010000000000000c65012100010000000000000c66012100010000000000000c67012100010000000000000c68012100010000000000000c69012100010000000000000c6a012100010000000000000c6b012100010000000000000c6c012100010000000000000c6d012100010000000000000c6e012100010000000000000c6f012100010000000000000c70012100010000000000000c71012100010000000000000c72012100010000000000000c73012100010000000000000c74012100010000000000000c75012100010000000000000c76012100010000000000000c77012100010000000000000c78012100010000000000000c79012100010000000000000c7a012100010000000000000c7b012100010000000000000c7c012100010000000000000c7d012100010000000000000c7e012100010000000000000c7f012100010000000000000c80012100010000000000000c81012100010000000000000c82012100010000000000000c83012100010000000000000c84012100010000000000000c85012100010000000000000c86012100010000000000000c87012100010000000000000c88012100010000000000000c89012100010000000000000c8a012100010000000000000c8b012100010000000000000c8c012100010000000000000c8d012100010000000000000c8e012100010000000000000c8f012100010000000000000c90012100010000000000000c91012100010000000000000c92012100010000000000000c93012100010000000000000c94012100010000000000000c95012100010000000000000c96012100010000000000000c97012100010000000000000c98012100010000000000000c99012100010000000000000c9a012100010000000000000c9b012100010000000000000c9c012100010000000000000c9d012100010000000000000c9e012100010000000000000c9f012100010000000000000ca0012100010000000000000ca1012100010000000000000ca2012100010000000000000ca3012100010000000000000ca4012100010000000000000ca5012100010000000000000ca6012100010000000000000ca7012100010000000000000ca8012100010000000000000ca9012100010000000000000caa012100010000000000000cab012100010000000000000cac012100010000000000000cad012100010000000000000cae012100010000000000000caf012100010000000000000cb0012100010000000000000cb1012100010000000000000cb2012100010000000000000cb3012100010000000000000cb4012100010000000000000cb5012100010000000000000cb6012100010000000000000cb7012100010000000000000cb8012100010000000000000cb9012100010000000000000cba012100010000000000000cbb012100010000000000000cbc012100010000000000000cbd012100010000000000000cbe012100010000000000000cbf012100010000000000000cc0012100010000000000000cc1012100010000000000000cc2012100010000000000000cc3012100010000000000000cc4012100010000000000000cc5012100010000000000000cc6012100010000000000000cc7012100010000000000000cc8012100010000000000000cc9012100010000000000000cca012100010000000000000ccb012100010000000000000ccc012100010000000000000ccd012100010000000000000cce012100010000000000000ccf012100010000000000000cd0012100010000000000000cd1012100010000000000000cd2012100010000000000000cd3012100010000000000000cd4012100010000000000000cd5012100010000000000000cd6012100010000000000000cd7012100010000000000000cd8012100010000000000000cd9012100010000000000000cda012100010000000000000cdb012100010000000000000cdc012100010000000000000cdd012100010000000000000cde012100010000000000000cdf012100010000000000000ce0012100010000000000000ce1012100010000000000000ce2012100010000000000000ce3012100010000000000000ce4012100010000000000000ce5012100010000000000000ce6012100010000000000000ce7012100010000000000000ce8012100010000000000000ce9012100010000000000000cea012100010000000000000ceb012100010000000000000cec012100010000000000000ced012100010000000000000cee012100010000000000000cef012100010000000000000cf0012100010000000000000cf1012100010000000000000cf2012100010000000000000cf3012100010000000000000cf4012100010000000000000cf5012100010000000000000cf6012100010000000000000cf7012100010000000000000cf8012100010000000000000cf9012100010000000000000cfa012100010000000000000cfb012100010000000000000cfc012100010000000000000cfd012100010000000000000cfe012100010000000000000cff012100010000000000000d00012100010000000000000d01012100010000000000000d02012100010000000000000d03012100010000000000000d04012100010000000000000d05012100010000000000000d06012100010000000000000d07012100010000000000000d08012100010000000000000d09012100010000000000000d0a012100010000000000000d0b012100010000000000000d0c012100010000000000000d0d012100010000000000000d0e012100010000000000000d0f012100010000000000000d10012100010000000000000d11012100010000000000000d12012100010000000000000d13012100010000000000000d14012100010000000000000d15012100010000000000000d16012100010000000000000d17012100010000000000000d18012100010000000000000d19012100010000000000000d1a012100010000000000000d1b012100010000000000000d1c012100010000000000000d1d012100010000000000000d1e012100010000000000000d1f012100010000000000000d20012100010000000000000d21012100010000000000000d22012100010000000000000d23012100010000000000000d24012100010000000000000d25012100010000000000000d26012100010000000000000d27012100010000000000000d28012100010000000000000d29012100010000000000000d2a012100010000000000000d2b012100010000000000000d2c012100010000000000000d2d012100010000000000000d2e012100010000000000000d2f012100010000000000000d30012100010000000000000d31012100010000000000000d32012100010000000000000d33012100010000000000000d34012100010000000000000d35012100010000000000000d36012100010000000000000d37012100010000000000000d38012100010000000000000d39012100010000000000000d3a012100010000000000000d3b012100010000000000000d3c012100010000000000000d3d012100010000000000000d3e012100010000000000000d3f012100010000000000000d40012100010000000000000d41012100010000000000000d42012100010000000000000d43012100010000000000000d44012100010000000000000d45012100010000000000000d46012100010000000000000d47012100010000000000000d48012100010000000000000d49012100010000000000000d4a012100010000000000000d4b012100010000000000000d4c012100010000000000000d4d012100010000000000000d4e012100010000000000000d4f012100010000000000000d50012100010000000000000d51012100010000000000000d52012100010000000000000d53012100010000000000000d54012100010000000000000d55012100010000000000000d56012100010000000000000d57012100010000000000000d58012100010000000000000d59012100010000000000000d5a012100010000000000000d5b012100010000000000000d5c012100010000000000000d5d012100010000000000000d5e012100010000000000000d5f012100010000000000000d60012100010000000000000d61012100010000000000000d62012100010000000000000d63012100010000000000000d64012100010000000000000d65012100010000000000000d66012100010000000000000d67012100010000000000000d68012100010000000000000d69012100010000000000000d6a012100010000000000000d6b012100010000000000000d6c012100010000000000000d6d012100010000000000000d6e012100010000000000000d6f012100010000000000000d70012100010000000000000d71012100010000000000000d72012100010000000000000d73012100010000000000000d74012100010000000000000d75012100010000000000000d76012100010000000000000d77012100010000000000000d78012100010000000000000d79012100010000000000000d7a012100010000000000000d7b012100010000000000000d7c012100010000000000000d7d012100010000000000000d7e012100010000000000000d7f012100010000000000000d80012100010000000000000d81012100010000000000000d82012100010000000000000d83012100010000000000000d84012100010000000000000d85012100010000000000000d86012100010000000000000d87012100010000000000000d88012100010000000000000d89012100010000000000000d8a012100010000000000000d8b012100010000000000000d8c012100010000000000000d8d012100010000000000000d8e012100010000000000000d8f012100010000000000000d90012100010000000000000d91012100010000000000000d92012100010000000000000d93012100010000000000000d94012100010000000000000d95012100010000000000000d96012100010000000000000d97012100010000000000000d98012100010000000000000d99012100010000000000000d9a012100010000000000000d9b012100010000000000000d9c012100010000000000000d9d012100010000000000000d9e012100010000000000000d9f012100010000000000000da0012100010000000000000da1012100010000000000000da2012100010000000000000da3012100010000000000000da4012100010000000000000da5012100010000000000000da6012100010000000000000da7012100010000000000000da8012100010000000000000da9012100010000000000000daa012100010000000000000dab012100010000000000000dac012100010000000000000dad012100010000000000000dae012100010000000000000daf012100010000000000000db0012100010000000000000db1012100010000000000000db2012100010000000000000db3012100010000000000000db4012100010000000000000db5012100010000000000000db6012100010000000000000db7012100010000000000000db8012100010000000000000db9012100010000000000000dba012100010000000000000dbb012100010000000000000dbc012100010000000000000dbd012100010000000000000dbe012100010000000000000dbf012100010000000000000dc0012100010000000000000dc1012100010000000000000dc2012100010000000000000dc3012100010000000000000dc4012100010000000000000dc5012100010000000000000dc6012100010000000000000dc7012100010000000000000dc8012100010000000000000dc9012100010000000000000dca012100010000000000000dcb012100010000000000000dcc012100010000000000000dcd012100010000000000000dce012100010000000000000dcf012100010000000000000dd0012100010000000000000dd1012100010000000000000dd2012100010000000000000dd3012100010000000000000dd4012100010000000000000dd5012100010000000000000dd6012100010000000000000dd7012100010000000000000dd8012100010000000000000dd9012100010000000000000dda012100010000000000000ddb012100010000000000000ddc012100010000000000000ddd012100010000000000000dde012100010000000000000ddf012100010000000000000de0012100010000000000000de1012100010000000000000de2012100010000000000000de3012100010000000000000de4012100010000000000000de5012100010000000000000de6012100010000000000000de7012100010000000000000de8012100010000000000000de9012100010000000000000dea012100010000000000000deb012100010000000000000dec012100010000000000000ded012100010000000000000dee012100010000000000000def012100010000000000000df0012100010000000000000df1012100010000000000000df2012100010000000000000df3012100010000000000000df4012100010000000000000df5012100010000000000000df6012100010000000000000df7012100010000000000000df8012100010000000000000df9012100010000000000000dfa012100010000000000000dfb012100010000000000000dfc012100010000000000000dfd012100010000000000000dfe012100010000000000000dff012100010000000000000e00012100010000000000000e01012100010000000000000e02012100010000000000000e03012100010000000000000e04012100010000000000000e05012100010000000000000e06012100010000000000000e07012100010000000000000e08012100010000000000000e09012100010000000000000e0a012100010000000000000e0b012100010000000000000e0c012100010000000000000e0d012100010000000000000e0e012100010000000000000e0f012100010000000000000e10012100010000000000000e11012100010000000000000e12012100010000000000000e13012100010000000000000e14012100010000000000000e15012100010000000000000e16012100010000000000000e17012100010000000000000e18012100010000000000000e19012100010000000000000e1a012100010000000000000e1b012100010000000000000e1c012100010000000000000e1d012100010000000000000e1e012100010000000000000e1f012100010000000000000e20012100010000000000000e21012100010000000000000e22012100010000000000000e23012100010000000000000e24012100010000000000000e25012100010000000000000e26012100010000000000000e27012100010000000000000e28012100010000000000000e29012100010000000000000e2a012100010000000000000e2b012100010000000000000e2c012100010000000000000e2d012100010000000000000e2e012100010000000000000e2f012100010000000000000e30012100010000000000000e31012100010000000000000e32012100010000000000000e33012100010000000000000e34012100010000000000000e35012100010000000000000e36012100010000000000000e37012100010000000000000e38012100010000000000000e39012100010000000000000e3a012100010000000000000e3b012100010000000000000e3c012100010000000000000e3d012100010000000000000e3e012100010000000000000e3f012100010000000000000e40012100010000000000000e41012100010000000000000e42012100010000000000000e43012100010000000000000e44012100010000000000000e45012100010000000000000e46012100010000000000000e47012100010000000000000e48012100010000000000000e49012100010000000000000e4a012100010000000000000e4b012100010000000000000e4c012100010000000000000e4d012100010000000000000e4e012100010000000000000e4f012100010000000000000e50012100010000000000000e51012100010000000000000e52012100010000000000000e53012100010000000000000e54012100010000000000000e55012100010000000000000e56012100010000000000000e57012100010000000000000e58012100010000000000000e59012100010000000000000e5a012100010000000000000e5b012100010000000000000e5c012100010000000000000e5d012100010000000000000e5e012100010000000000000e5f012100010000000000000e60012100010000000000000e61012100010000000000000e62012100010000000000000e63012100010000000000000e64012100010000000000000e65012100010000000000000e66012100010000000000000e67012100010000000000000e68012100010000000000000e69012100010000000000000e6a012100010000000000000e6b012100010000000000000e6c012100010000000000000e6d012100010000000000000e6e012100010000000000000e6f012100010000000000000e70012100010000000000000e71012100010000000000000e72012100010000000000000e73012100010000000000000e74012100010000000000000e75012100010000000000000e76012100010000000000000e77012100010000000000000e78012100010000000000000e79012100010000000000000e7a012100010000000000000e7b012100010000000000000e7c012100010000000000000e7d012100010000000000000e7e012100010000000000000e7f012100010000000000000e80012100010000000000000e81012100010000000000000e82012100010000000000000e83012100010000000000000e84012100010000000000000e85012100010000000000000e86012100010000000000000e87012100010000000000000e88012100010000000000000e89012100010000000000000e8a012100010000000000000e8b012100010000000000000e8c012100010000000000000e8d012100010000000000000e8e012100010000000000000e8f012100010000000000000e90012100010000000000000e91012100010000000000000e92012100010000000000000e93012100010000000000000e94012100010000000000000e95012100010000000000000e96012100010000000000000e97012100010000000000000e98012100010000000000000e99012100010000000000000e9a012100010000000000000e9b012100010000000000000e9c012100010000000000000e9d012100010000000000000e9e012100010000000000000e9f012100010000000000000ea0012100010000000000000ea1012100010000000000000ea2012100010000000000000ea3012100010000000000000ea4012100010000000000000ea5012100010000000000000ea6012100010000000000000ea7012100010000000000000ea8012100010000000000000ea9012100010000000000000eaa012100010000000000000eab012100010000000000000eac012100010000000000000ead012100010000000000000eae012100010000000000000eaf012100010000000000000eb0012100010000000000000eb1012100010000000000000eb2012100010000000000000eb3012100010000000000000eb4012100010000000000000eb5012100010000000000000eb6012100010000000000000eb7012100010000000000000eb8012100010000000000000eb9012100010000000000000eba012100010000000000000ebb012100010000000000000ebc012100010000000000000ebd012100010000000000000ebe012100010000000000000ebf012100010000000000000ec0012100010000000000000ec1012100010000000000000ec2012100010000000000000ec3012100010000000000000ec4012100010000000000000ec5012100010000000000000ec6012100010000000000000ec7012100010000000000000ec8012100010000000000000ec9012100010000000000000eca012100010000000000000ecb012100010000000000000ecc012100010000000000000ecd012100010000000000000ece012100010000000000000ecf012100010000000000000ed0012100010000000000000ed1012100010000000000000ed2012100010000000000000ed3012100010000000000000ed4012100010000000000000ed5012100010000000000000ed6012100010000000000000ed7012100010000000000000ed8012100010000000000000ed9012100010000000000000eda012100010000000000000edb012100010000000000000edc012100010000000000000edd012100010000000000000ede012100010000000000000edf012100010000000000000ee0012100010000000000000ee1012100010000000000000ee2012100010000000000000ee3012100010000000000000ee4012100010000000000000ee5012100010000000000000ee6012100010000000000000ee7012100010000000000000ee8012100010000000000000ee9012100010000000000000eea012100010000000000000eeb012100010000000000000eec012100010000000000000eed012100010000000000000eee012100010000000000000eef012100010000000000000ef0012100010000000000000ef1012100010000000000000ef2012100010000000000000ef3012100010000000000000ef4012100010000000000000ef5012100010000000000000ef6012100010000000000000ef7012100010000000000000ef8012100010000000000000ef9012100010000000000000efa012100010000000000000efb012100010000000000000efc012100010000000000000efd012100010000000000000efe012100010000000000000eff012100010000000000000f00012100010000000000000f01012100010000000000000f02012100010000000000000f03012100010000000000000f04012100010000000000000f05012100010000000000000f06012100010000000000000f07012100010000000000000f08012100010000000000000f09012100010000000000000f0a012100010000000000000f0b012100010000000000000f0c012100010000000000000f0d012100010000000000000f0e012100010000000000000f0f012100010000000000000f10012100010000000000000f11012100010000000000000f12012100010000000000000f13012100010000000000000f14012100010000000000000f15012100010000000000000f16012100010000000000000f17012100010000000000000f18012100010000000000000f19012100010000000000000f1a012100010000000000000f1b012100010000000000000f1c012100010000000000000f1d012100010000000000000f1e012100010000000000000f1f012100010000000000000f20012100010000000000000f21012100010000000000000f22012100010000000000000f23012100010000000000000f24012100010000000000000f25012100010000000000000f26012100010000000000000f27012100010000000000000f28012100010000000000000f29012100010000000000000f2a012100010000000000000f2b012100010000000000000f2c012100010000000000000f2d012100010000000000000f2e012100010000000000000f2f012100010000000000000f30012100010000000000000f31012100010000000000000f32012100010000000000000f33012100010000000000000f34012100010000000000000f35012100010000000000000f36012100010000000000000f37012100010000000000000f38012100010000000000000f39012100010000000000000f3a012100010000000000000f3b012100010000000000000f3c012100010000000000000f3d012100010000000000000f3e012100010000000000000f3f012100010000000000000f40012100010000000000000f41012100010000000000000f42012100010000000000000f43012100010000000000000f44012100010000000000000f45012100010000000000000f46012100010000000000000f47012100010000000000000f48012100010000000000000f49012100010000000000000f4a012100010000000000000f4b012100010000000000000f4c012100010000000000000f4d012100010000000000000f4e012100010000000000000f4f012100010000000000000f50012100010000000000000f51012100010000000000000f52012100010000000000000f53012100010000000000000f54012100010000000000000f55012100010000000000000f56012100010000000000000f57012100010000000000000f58012100010000000000000f59012100010000000000000f5a012100010000000000000f5b012100010000000000000f5c012100010000000000000f5d012100010000000000000f5e012100010000000000000f5f012100010000000000000f60012100010000000000000f61012100010000000000000f62012100010000000000000f63012100010000000000000f64012100010000000000000f65012100010000000000000f66012100010000000000000f67012100010000000000000f68012100010000000000000f69012100010000000000000f6a012100010000000000000f6b012100010000000000000f6c012100010000000000000f6d012100010000000000000f6e012100010000000000000f6f012100010000000000000f70012100010000000000000f71012100010000000000000f72012100010000000000000f73012100010000000000000f74012100010000000000000f75012100010000000000000f76012100010000000000000f77012100010000000000000f78012100010000000000000f79012100010000000000000f7a012100010000000000000f7b012100010000000000000f7c012100010000000000000f7d012100010000000000000f7e012100010000000000000f7f012100010000000000000f80012100010000000000000f81012100010000000000000f82012100010000000000000f83012100010000000000000f84012100010000000000000f85012100010000000000000f86012100010000000000000f87012100010000000000000f88012100010000000000000f89012100010000000000000f8a012100010000000000000f8b012100010000000000000f8c012100010000000000000f8d012100010000000000000f8e012100010000000000000f8f012100010000000000000f90012100010000000000000f91012100010000000000000f92012100010000000000000f93012100010000000000000f94012100010000000000000f95012100010000000000000f96012100010000000000000f97012100010000000000000f98012100010000000000000f99012100010000000000000f9a012100010000000000000f9b012100010000000000000f9c012100010000000000000f9d012100010000000000000f9e012100010000000000000f9f012100010000000000000fa0012100010000000000000fa1012100010000000000000fa2012100010000000000000fa3012100010000000000000fa4012100010000000000000fa5012100010000000000000fa6012100010000000000000fa7012100010000000000000fa8012100010000000000000fa9012100010000000000000faa012100010000000000000fab012100010000000000000fac012100010000000000000fad012100010000000000000fae012100010000000000000faf012100010000000000000fb0012100010000000000000fb1012100010000000000000fb2012100010000000000000fb3012100010000000000000fb4012100010000000000000fb5012100010000000000000fb6012100010000000000000fb7012100010000000000000fb8012100010000000000000fb9012100010000000000000fba012100010000000000000fbb012100010000000000000fbc012100010000000000000fbd012100010000000000000fbe012100010000000000000fbf012100010000000000000fc0012100010000000000000fc1012100010000000000000fc2012100010000000000000fc3012100010000000000000fc4012100010000000000000fc5012100010000000000000fc6012100010000000000000fc7012100010000000000000fc8012100010000000000000fc9012100010000000000000fca012100010000000000000fcb012100010000000000000fcc012100010000000000000fcd012100010000000000000fce012100010000000000000fcf012100010000000000000fd0012100010000000000000fd1012100010000000000000fd2012100010000000000000fd3012100010000000000000fd4012100010000000000000fd5012100010000000000000fd6012100010000000000000fd7012100010000000000000fd8012100010000000000000fd9012100010000000000000fda012100010000000000000fdb012100010000000000000fdc012100010000000000000fdd012100010000000000000fde012100010000000000000fdf012100010000000000000fe0012100010000000000000fe1012100010000000000000fe2012100010000000000000fe3012100010000000000000fe4012100010000000000000fe5012100010000000000000fe6012100010000000000000fe7012100010000000000000fe8012100010000000000000fe9012100010000000000000fea012100010000000000000feb012100010000000000000fec012100010000000000000fed012100010000000000000fee012100010000000000000fef012100010000000000000ff0012100010000000000000ff1012100010000000000000ff2012100010000000000000ff3012100010000000000000ff4012100010000000000000ff5012100010000000000000ff6012100010000000000000ff7012100010000000000000ff8012100010000000000000ff9012100010000000000000ffa012100010000000000000ffb012100010000000000000ffc012100010000000000000ffd012100010000000000000ffe012100010000000000000fff01210001000000000000100001210001000000000000100101210001000000000000100201210001000000000000100301210001000000000000100401210001000000000000100501210001000000000000100601210001000000000000100701210001000000000000100801210001000000000000100901210001000000000000100a01210001000000000000100b01210001000000000000100c01210001000000000000100d01210001000000000000100e01210001000000000000100f01210001000000000000101001210001000000000000101101210001000000000000101201210001000000000000101301210001000000000000101401210001000000000000101501210001000000000000101601210001000000000000101701210001000000000000101801210001000000000000101901210001000000000000101a01210001000000000000101b01210001000000000000101c01210001000000000000101d01210001000000000000101e01210001000000000000101f01210001000000000000102001210001000000000000102101210001000000000000102201210001000000000000102301210001000000000000102401210001000000000000102501210001000000000000102601210001000000000000102701210001000000000000102801210001000000000000102901210001000000000000102a01210001000000000000102b01210001000000000000102c01210001000000000000102d01210001000000000000102e01210001000000000000102f01210001000000000000103001210001000000000000103101210001000000000000103201210001000000000000103301210001000000000000103401210001000000000000103501210001000000000000103601210001000000000000103701210001000000000000103801210001000000000000103901210001000000000000103a01210001000000000000103b01210001000000000000103c01210001000000000000103d01210001000000000000103e01210001000000000000103f01210001000000000000104001210001000000000000104101210001000000000000104201210001000000000000104301210001000000000000104401210001000000000000104501210001000000000000104601210001000000000000104701210001000000000000104801210001000000000000104901210001000000000000104a01210001000000000000104b01210001000000000000104c01210001000000000000104d01210001000000000000104e01210001000000000000104f01210001000000000000105001210001000000000000105101210001000000000000105201210001000000000000105301210001000000000000105401210001000000000000105501210001000000000000105601210001000000000000105701210001000000000000105801210001000000000000105901210001000000000000105a01210001000000000000105b01210001000000000000105c01210001000000000000105d01210001000000000000105e01210001000000000000105f01210001000000000000106001210001000000000000106101210001000000000000106201210001000000000000106301210001000000000000106401210001000000000000106501210001000000000000106601210001000000000000106701210001000000000000106801210001000000000000106901210001000000000000106a01210001000000000000106b01210001000000000000106c01210001000000000000106d01210001000000000000106e01210001000000000000106f01210001000000000000107001210001000000000000107101210001000000000000107201210001000000000000107301210001000000000000107401210001000000000000107501210001000000000000107601210001000000000000107701210001000000000000107801210001000000000000107901210001000000000000107a01210001000000000000107b01210001000000000000107c01210001000000000000107d01210001000000000000107e01210001000000000000107f01210001000000000000108001210001000000000000108101210001000000000000108201210001000000000000108301210001000000000000108401210001000000000000108501210001000000000000108601210001000000000000108701210001000000000000108801210001000000000000108901210001000000000000108a01210001000000000000108b01210001000000000000108c01210001000000000000108d01210001000000000000108e01210001000000000000108f01210001000000000000109001210001000000000000109101210001000000000000109201210001000000000000109301210001000000000000109401210001000000000000109501210001000000000000109601210001000000000000109701210001000000000000109801210001000000000000109901210001000000000000109a01210001000000000000109b01210001000000000000109c01210001000000000000109d01210001000000000000109e01210001000000000000109f0121000100000000000010a00121000100000000000010a10121000100000000000010a20121000100000000000010a30121000100000000000010a40121000100000000000010a50121000100000000000010a60121000100000000000010a70121000100000000000010a80121000100000000000010a90121000100000000000010aa0121000100000000000010ab0121000100000000000010ac0121000100000000000010ad0121000100000000000010ae0121000100000000000010af0121000100000000000010b00121000100000000000010b10121000100000000000010b20121000100000000000010b30121000100000000000010b40121000100000000000010b50121000100000000000010b60121000100000000000010b70121000100000000000010b80121000100000000000010b90121000100000000000010ba0121000100000000000010bb0121000100000000000010bc0121000100000000000010bd0121000100000000000010be0121000100000000000010bf0121000100000000000010c00121000100000000000010c10121000100000000000010c20121000100000000000010c30121000100000000000010c40121000100000000000010c50121000100000000000010c60121000100000000000010c70121000100000000000010c80121000100000000000010c90121000100000000000010ca0121000100000000000010cb0121000100000000000010cc0121000100000000000010cd0121000100000000000010ce0121000100000000000010cf0121000100000000000010d00121000100000000000010d10121000100000000000010d20121000100000000000010d30121000100000000000010d40121000100000000000010d50121000100000000000010d60121000100000000000010d70121000100000000000010d80121000100000000000010d90121000100000000000010da0121000100000000000010db0121000100000000000010dc0121000100000000000010dd0121000100000000000010de0121000100000000000010df0121000100000000000010e00121000100000000000010e10121000100000000000010e20121000100000000000010e30121000100000000000010e40121000100000000000010e50121000100000000000010e60121000100000000000010e70121000100000000000010e80121000100000000000010e90121000100000000000010ea0121000100000000000010eb0121000100000000000010ec0121000100000000000010ed0121000100000000000010ee0121000100000000000010ef0121000100000000000010f00121000100000000000010f10121000100000000000010f20121000100000000000010f30121000100000000000010f40121000100000000000010f50121000100000000000010f60121000100000000000010f70121000100000000000010f80121000100000000000010f90121000100000000000010fa0121000100000000000010fb0121000100000000000010fc0121000100000000000010fd0121000100000000000010fe0121000100000000000010ff01210001000000000000110001210001000000000000110101210001000000000000110201210001000000000000110301210001000000000000110401210001000000000000110501210001000000000000110601210001000000000000110701210001000000000000110801210001000000000000110901210001000000000000110a01210001000000000000110b01210001000000000000110c01210001000000000000110d01210001000000000000110e01210001000000000000110f01210001000000000000111001210001000000000000111101210001000000000000111201210001000000000000111301210001000000000000111401210001000000000000111501210001000000000000111601210001000000000000111701210001000000000000111801210001000000000000111901210001000000000000111a01210001000000000000111b01210001000000000000111c01210001000000000000111d01210001000000000000111e01210001000000000000111f01210001000000000000112001210001000000000000112101210001000000000000112201210001000000000000112301210001000000000000112401210001000000000000112501210001000000000000112601210001000000000000112701210001000000000000112801210001000000000000112901210001000000000000112a01210001000000000000112b01210001000000000000112c01210001000000000000112d01210001000000000000112e01210001000000000000112f01210001000000000000113001210001000000000000113101210001000000000000113201210001000000000000113301210001000000000000113401210001000000000000113501210001000000000000113601210001000000000000113701210001000000000000113801210001000000000000113901210001000000000000113a01210001000000000000113b01210001000000000000113c01210001000000000000113d01210001000000000000113e01210001000000000000113f01210001000000000000114001210001000000000000114101210001000000000000114201210001000000000000114301210001000000000000114401210001000000000000114501210001000000000000114601210001000000000000114701210001000000000000114801210001000000000000114901210001000000000000114a01210001000000000000114b01210001000000000000114c01210001000000000000114d01210001000000000000114e01210001000000000000114f01210001000000000000115001210001000000000000115101210001000000000000115201210001000000000000115301210001000000000000115401210001000000000000115501210001000000000000115601210001000000000000115701210001000000000000115801210001000000000000115901210001000000000000115a01210001000000000000115b01210001000000000000115c01210001000000000000115d01210001000000000000115e01210001000000000000115f01210001000000000000116001210001000000000000116101210001000000000000116201210001000000000000116301210001000000000000116401210001000000000000116501210001000000000000116601210001000000000000116701210001000000000000116801210001000000000000116901210001000000000000116a01210001000000000000116b01210001000000000000116c01210001000000000000116d01210001000000000000116e01210001000000000000116f01210001000000000000117001210001000000000000117101210001000000000000117201210001000000000000117301210001000000000000117401210001000000000000117501210001000000000000117601210001000000000000117701210001000000000000117801210001000000000000117901210001000000000000117a01210001000000000000117b01210001000000000000117c01210001000000000000117d01210001000000000000117e01210001000000000000117f01210001000000000000118001210001000000000000118101210001000000000000118201210001000000000000118301210001000000000000118401210001000000000000118501210001000000000000118601210001000000000000118701210001000000000000118801210001000000000000118901210001000000000000118a01210001000000000000118b01210001000000000000118c01210001000000000000118d01210001000000000000118e01210001000000000000118f01210001000000000000119001210001000000000000119101210001000000000000119201210001000000000000119301210001000000000000119401210001000000000000119501210001000000000000119601210001000000000000119701210001000000000000119801210001000000000000119901210001000000000000119a01210001000000000000119b01210001000000000000119c01210001000000000000119d01210001000000000000119e01210001000000000000119f0121000100000000000011a00121000100000000000011a10121000100000000000011a20121000100000000000011a30121000100000000000011a40121000100000000000011a50121000100000000000011a60121000100000000000011a70121000100000000000011a80121000100000000000011a90121000100000000000011aa0121000100000000000011ab0121000100000000000011ac0121000100000000000011ad0121000100000000000011ae0121000100000000000011af0121000100000000000011b00121000100000000000011b10121000100000000000011b20121000100000000000011b30121000100000000000011b40121000100000000000011b50121000100000000000011b60121000100000000000011b70121000100000000000011b80121000100000000000011b90121000100000000000011ba0121000100000000000011bb0121000100000000000011bc0121000100000000000011bd0121000100000000000011be0121000100000000000011bf0121000100000000000011c00121000100000000000011c10121000100000000000011c20121000100000000000011c30121000100000000000011c40121000100000000000011c50121000100000000000011c60121000100000000000011c70121000100000000000011c80121000100000000000011c90121000100000000000011ca0121000100000000000011cb0121000100000000000011cc0121000100000000000011cd0121000100000000000011ce0121000100000000000011cf0121000100000000000011d00121000100000000000011d10121000100000000000011d20121000100000000000011d30121000100000000000011d40121000100000000000011d50121000100000000000011d60121000100000000000011d70121000100000000000011d80121000100000000000011d90121000100000000000011da0121000100000000000011db0121000100000000000011dc0121000100000000000011dd0121000100000000000011de0121000100000000000011df0121000100000000000011e00121000100000000000011e10121000100000000000011e20121000100000000000011e30121000100000000000011e40121000100000000000011e50121000100000000000011e60121000100000000000011e70121000100000000000011e80121000100000000000011e90121000100000000000011ea0121000100000000000011eb0121000100000000000011ec0121000100000000000011ed0121000100000000000011ee0121000100000000000011ef0121000100000000000011f00121000100000000000011f10121000100000000000011f20121000100000000000011f30121000100000000000011f40121000100000000000011f50121000100000000000011f60121000100000000000011f70121000100000000000011f80121000100000000000011f90121000100000000000011fa0121000100000000000011fb0121000100000000000011fc0121000100000000000011fd0121000100000000000011fe0121000100000000000011ff01210001000000000000120001210001000000000000120101210001000000000000120201210001000000000000120301210001000000000000120401210001000000000000120501210001000000000000120601210001000000000000120701210001000000000000120801210001000000000000120901210001000000000000120a01210001000000000000120b01210001000000000000120c01210001000000000000120d01210001000000000000120e01210001000000000000120f01210001000000000000121001210001000000000000121101210001000000000000121201210001000000000000121301210001000000000000121401210001000000000000121501210001000000000000121601210001000000000000121701210001000000000000121801210001000000000000121901210001000000000000121a01210001000000000000121b01210001000000000000121c01210001000000000000121d01210001000000000000121e01210001000000000000121f01210001000000000000122001210001000000000000122101210001000000000000122201210001000000000000122301210001000000000000122401210001000000000000122501210001000000000000122601210001000000000000122701210001000000000000122801210001000000000000122901210001000000000000122a01210001000000000000122b01210001000000000000122c01210001000000000000122d01210001000000000000122e01210001000000000000122f01210001000000000000123001210001000000000000123101210001000000000000123201210001000000000000123301210001000000000000123401210001000000000000123501210001000000000000123601210001000000000000123701210001000000000000123801210001000000000000123901210001000000000000123a01210001000000000000123b01210001000000000000123c01210001000000000000123d01210001000000000000123e01210001000000000000123f01210001000000000000124001210001000000000000124101210001000000000000124201210001000000000000124301210001000000000000124401210001000000000000124501210001000000000000124601210001000000000000124701210001000000000000124801210001000000000000124901210001000000000000124a01210001000000000000124b01210001000000000000124c01210001000000000000124d01210001000000000000124e01210001000000000000124f01210001000000000000125001210001000000000000125101210001000000000000125201210001000000000000125301210001000000000000125401210001000000000000125501210001000000000000125601210001000000000000125701210001000000000000125801210001000000000000125901210001000000000000125a01210001000000000000125b01210001000000000000125c01210001000000000000125d01210001000000000000125e01210001000000000000125f01210001000000000000126001210001000000000000126101210001000000000000126201210001000000000000126301210001000000000000126401210001000000000000126501210001000000000000126601210001000000000000126701210001000000000000126801210001000000000000126901210001000000000000126a01210001000000000000126b01210001000000000000126c01210001000000000000126d01210001000000000000126e01210001000000000000126f01210001000000000000127001210001000000000000127101210001000000000000127201210001000000000000127301210001000000000000127401210001000000000000127501210001000000000000127601210001000000000000127701210001000000000000127801210001000000000000127901210001000000000000127a01210001000000000000127b01210001000000000000127c01210001000000000000127d01210001000000000000127e01210001000000000000127f01210001000000000000128001210001000000000000128101210001000000000000128201210001000000000000128301210001000000000000128401210001000000000000128501210001000000000000128601210001000000000000128701210001000000000000128801210001000000000000128901210001000000000000128a01210001000000000000128b01210001000000000000128c01210001000000000000128d01210001000000000000128e01210001000000000000128f01210001000000000000129001210001000000000000129101210001000000000000129201210001000000000000129301210001000000000000129401210001000000000000129501210001000000000000129601210001000000000000129701210001000000000000129801210001000000000000129901210001000000000000129a01210001000000000000129b01210001000000000000129c01210001000000000000129d01210001000000000000129e01210001000000000000129f0121000100000000000012a00121000100000000000012a10121000100000000000012a20121000100000000000012a30121000100000000000012a40121000100000000000012a50121000100000000000012a60121000100000000000012a70121000100000000000012a80121000100000000000012a90121000100000000000012aa0121000100000000000012ab0121000100000000000012ac0121000100000000000012ad0121000100000000000012ae0121000100000000000012af0121000100000000000012b00121000100000000000012b10121000100000000000012b20121000100000000000012b30121000100000000000012b40121000100000000000012b50121000100000000000012b60121000100000000000012b70121000100000000000012b80121000100000000000012b90121000100000000000012ba0121000100000000000012bb0121000100000000000012bc0121000100000000000012bd0121000100000000000012be0121000100000000000012bf0121000100000000000012c00121000100000000000012c10121000100000000000012c20121000100000000000012c30121000100000000000012c40121000100000000000012c50121000100000000000012c60121000100000000000012c70121000100000000000012c80121000100000000000012c90121000100000000000012ca0121000100000000000012cb0121000100000000000012cc0121000100000000000012cd0121000100000000000012ce0121000100000000000012cf0121000100000000000012d00121000100000000000012d10121000100000000000012d20121000100000000000012d30121000100000000000012d40121000100000000000012d50121000100000000000012d60121000100000000000012d70121000100000000000012d80121000100000000000012d90121000100000000000012da0121000100000000000012db0121000100000000000012dc0121000100000000000012dd0121000100000000000012de0121000100000000000012df0121000100000000000012e00121000100000000000012e10121000100000000000012e20121000100000000000012e30121000100000000000012e40121000100000000000012e50121000100000000000012e60121000100000000000012e70121000100000000000012e80121000100000000000012e90121000100000000000012ea0121000100000000000012eb0121000100000000000012ec0121000100000000000012ed0121000100000000000012ee0121000100000000000012ef0121000100000000000012f00121000100000000000012f10121000100000000000012f20121000100000000000012f30121000100000000000012f40121000100000000000012f50121000100000000000012f60121000100000000000012f70121000100000000000012f80121000100000000000012f90121000100000000000012fa0121000100000000000012fb0121000100000000000012fc0121000100000000000012fd0121000100000000000012fe0121000100000000000012ff01210001000000000000130001210001000000000000130101210001000000000000130201210001000000000000130301210001000000000000130401210001000000000000130501210001000000000000130601210001000000000000130701210001000000000000130801210001000000000000130901210001000000000000130a01210001000000000000130b01210001000000000000130c01210001000000000000130d01210001000000000000130e01210001000000000000130f01210001000000000000131001210001000000000000131101210001000000000000131201210001000000000000131301210001000000000000131401210001000000000000131501210001000000000000131601210001000000000000131701210001000000000000131801210001000000000000131901210001000000000000131a01210001000000000000131b01210001000000000000131c01210001000000000000131d01210001000000000000131e01210001000000000000131f01210001000000000000132001210001000000000000132101210001000000000000132201210001000000000000132301210001000000000000132401210001000000000000132501210001000000000000132601210001000000000000132701210001000000000000132801210001000000000000132901210001000000000000132a01210001000000000000132b01210001000000000000132c01210001000000000000132d01210001000000000000132e01210001000000000000132f01210001000000000000133001210001000000000000133101210001000000000000133201210001000000000000133301210001000000000000133401210001000000000000133501210001000000000000133601210001000000000000133701210001000000000000133801210001000000000000133901210001000000000000133a01210001000000000000133b01210001000000000000133c01210001000000000000133d01210001000000000000133e01210001000000000000133f01210001000000000000134001210001000000000000134101210001000000000000134201210001000000000000134301210001000000000000134401210001000000000000134501210001000000000000134601210001000000000000134701210001000000000000134801210001000000000000134901210001000000000000134a01210001000000000000134b01210001000000000000134c01210001000000000000134d01210001000000000000134e01210001000000000000134f01210001000000000000135001210001000000000000135101210001000000000000135201210001000000000000135301210001000000000000135401210001000000000000135501210001000000000000135601210001000000000000135701210001000000000000135801210001000000000000135901210001000000000000135a01210001000000000000135b01210001000000000000135c01210001000000000000135d01210001000000000000135e01210001000000000000135f01210001000000000000136001210001000000000000136101210001000000000000136201210001000000000000136301210001000000000000136401210001000000000000136501210001000000000000136601210001000000000000136701210001000000000000136801210001000000000000136901210001000000000000136a01210001000000000000136b01210001000000000000136c01210001000000000000136d01210001000000000000136e01210001000000000000136f01210001000000000000137001210001000000000000137101210001000000000000137201210001000000000000137301210001000000000000137401210001000000000000137501210001000000000000137601210001000000000000137701210001000000000000137801210001000000000000137901210001000000000000137a01210001000000000000137b01210001000000000000137c01210001000000000000137d01210001000000000000137e01210001000000000000137f01210001000000000000138001210001000000000000138101210001000000000000138201210001000000000000138301210001000000000000138401210001000000000000138501210001000000000000138601210001000000000000138701210001000000000000138801210001000000000000138901210001000000000000138a01210001000000000000138b01210001000000000000138c01210001000000000000138d01210001000000000000138e01210001000000000000138f01210001000000000000139001210001000000000000139101210001000000000000139201210001000000000000139301210001000000000000139401210001000000000000139501210001000000000000139601210001000000000000139701210001000000000000139801210001000000000000139901210001000000000000139a01210001000000000000139b01210001000000000000139c01210001000000000000139d01210001000000000000139e01210001000000000000139f0121000100000000000013a00121000100000000000013a10121000100000000000013a20121000100000000000013a30121000100000000000013a40121000100000000000013a50121000100000000000013a60121000100000000000013a70121000100000000000013a80121000100000000000013a90121000100000000000013aa0121000100000000000013ab0121000100000000000013ac0121000100000000000013ad0121000100000000000013ae0121000100000000000013af0121000100000000000013b00121000100000000000013b10121000100000000000013b20121000100000000000013b30121000100000000000013b40121000100000000000013b50121000100000000000013b60121000100000000000013b70121000100000000000013b80121000100000000000013b90121000100000000000013ba0121000100000000000013bb0121000100000000000013bc0121000100000000000013bd0121000100000000000013be0121000100000000000013bf0121000100000000000013c00121000100000000000013c10121000100000000000013c20121000100000000000013c30121000100000000000013c40121000100000000000013c50121000100000000000013c60121000100000000000013c70121000100000000000013c80121000100000000000013c90121000100000000000013ca0121000100000000000013cb0121000100000000000013cc0121000100000000000013cd0121000100000000000013ce0121000100000000000013cf0121000100000000000013d00121000100000000000013d10121000100000000000013d20121000100000000000013d30121000100000000000013d40121000100000000000013d50121000100000000000013d60121000100000000000013d70121000100000000000013d80121000100000000000013d90121000100000000000013da0121000100000000000013db0121000100000000000013dc0121000100000000000013dd0121000100000000000013de0121000100000000000013df0121000100000000000013e00121000100000000000013e10121000100000000000013e20121000100000000000013e30121000100000000000013e40121000100000000000013e50121000100000000000013e60121000100000000000013e70121000100000000000013e80121000100000000000013e90121000100000000000013ea0121000100000000000013eb0121000100000000000013ec0121000100000000000013ed0121000100000000000013ee0121000100000000000013ef0121000100000000000013f00121000100000000000013f10121000100000000000013f20121000100000000000013f30121000100000000000013f40121000100000000000013f50121000100000000000013f60121000100000000000013f70121000100000000000013f80121000100000000000013f90121000100000000000013fa0121000100000000000013fb0121000100000000000013fc0121000100000000000013fd0121000100000000000013fe0121000100000000000013ff01210001000000000000140001210001000000000000140101210001000000000000140201210001000000000000140301210001000000000000140401210001000000000000140501210001000000000000140601210001000000000000140701210001000000000000140801210001000000000000140901210001000000000000140a01210001000000000000140b01210001000000000000140c01210001000000000000140d01210001000000000000140e01210001000000000000140f01210001000000000000141001210001000000000000141101210001000000000000141201210001000000000000141301210001000000000000141401210001000000000000141501210001000000000000141601210001000000000000141701210001000000000000141801210001000000000000141901210001000000000000141a01210001000000000000141b01210001000000000000141c01210001000000000000141d01210001000000000000141e01210001000000000000141f01210001000000000000142001210001000000000000142101210001000000000000142201210001000000000000142301210001000000000000142401210001000000000000142501210001000000000000142601210001000000000000142701210001000000000000142801210001000000000000142901210001000000000000142a01210001000000000000142b01210001000000000000142c01210001000000000000142d01210001000000000000142e01210001000000000000142f01210001000000000000143001210001000000000000143101210001000000000000143201210001000000000000143301210001000000000000143401210001000000000000143501210001000000000000143601210001000000000000143701210001000000000000143801210001000000000000143901210001000000000000143a01210001000000000000143b01210001000000000000143c01210001000000000000143d01210001000000000000143e01210001000000000000143f01210001000000000000144001210001000000000000144101210001000000000000144201210001000000000000144301210001000000000000144401210001000000000000144501210001000000000000144601210001000000000000144701210001000000000000144801210001000000000000144901210001000000000000144a01210001000000000000144b01210001000000000000144c01210001000000000000144d01210001000000000000144e01210001000000000000144f01210001000000000000145001210001000000000000145101210001000000000000145201210001000000000000145301210001000000000000145401210001000000000000145501210001000000000000145601210001000000000000145701210001000000000000145801210001000000000000145901210001000000000000145a01210001000000000000145b01210001000000000000145c01210001000000000000145d01210001000000000000145e01210001000000000000145f01210001000000000000146001210001000000000000146101210001000000000000146201210001000000000000146301210001000000000000146401210001000000000000146501210001000000000000146601210001000000000000146701210001000000000000146801210001000000000000146901210001000000000000146a01210001000000000000146b01210001000000000000146c01210001000000000000146d01210001000000000000146e01210001000000000000146f01210001000000000000147001210001000000000000147101210001000000000000147201210001000000000000147301210001000000000000147401210001000000000000147501210001000000000000147601210001000000000000147701210001000000000000147801210001000000000000147901210001000000000000147a01210001000000000000147b01210001000000000000147c01210001000000000000147d01210001000000000000147e01210001000000000000147f01210001000000000000148001210001000000000000148101210001000000000000148201210001000000000000148301210001000000000000148401210001000000000000148501210001000000000000148601210001000000000000148701210001000000000000148801210001000000000000148901210001000000000000148a01210001000000000000148b01210001000000000000148c01210001000000000000148d01210001000000000000148e01210001000000000000148f01210001000000000000149001210001000000000000149101210001000000000000149201210001000000000000149301210001000000000000149401210001000000000000149501210001000000000000149601210001000000000000149701210001000000000000149801210001000000000000149901210001000000000000149a01210001000000000000149b01210001000000000000149c01210001000000000000149d01210001000000000000149e01210001000000000000149f0121000100000000000014a00121000100000000000014a10121000100000000000014a20121000100000000000014a30121000100000000000014a40121000100000000000014a50121000100000000000014a60121000100000000000014a70121000100000000000014a80121000100000000000014a90121000100000000000014aa0121000100000000000014ab0121000100000000000014ac0121000100000000000014ad0121000100000000000014ae0121000100000000000014af0121000100000000000014b00121000100000000000014b10121000100000000000014b20121000100000000000014b30121000100000000000014b40121000100000000000014b50121000100000000000014b60121000100000000000014b70121000100000000000014b80121000100000000000014b90121000100000000000014ba0121000100000000000014bb0121000100000000000014bc0121000100000000000014bd0121000100000000000014be0121000100000000000014bf0121000100000000000014c00121000100000000000014c10121000100000000000014c20121000100000000000014c30121000100000000000014c40121000100000000000014c50121000100000000000014c60121000100000000000014c70121000100000000000014c80121000100000000000014c90121000100000000000014ca0121000100000000000014cb0121000100000000000014cc0121000100000000000014cd0121000100000000000014ce0121000100000000000014cf0121000100000000000014d00121000100000000000014d10121000100000000000014d20121000100000000000014d30121000100000000000014d40121000100000000000014d50121000100000000000014d60121000100000000000014d70121000100000000000014d80121000100000000000014d90121000100000000000014da0121000100000000000014db0121000100000000000014dc0121000100000000000014dd0121000100000000000014de0121000100000000000014df0121000100000000000014e00121000100000000000014e10121000100000000000014e20121000100000000000014e30121000100000000000014e40121000100000000000014e50121000100000000000014e60121000100000000000014e70121000100000000000014e80121000100000000000014e90121000100000000000014ea0121000100000000000014eb0121000100000000000014ec0121000100000000000014ed0121000100000000000014ee0121000100000000000014ef0121000100000000000014f00121000100000000000014f10121000100000000000014f20121000100000000000014f30121000100000000000014f40121000100000000000014f50121000100000000000014f60121000100000000000014f70121000100000000000014f80121000100000000000014f90121000100000000000014fa0121000100000000000014fb0121000100000000000014fc0121000100000000000014fd0121000100000000000014fe0121000100000000000014ff01210001000000000000150001210001000000000000150101210001000000000000150201210001000000000000150301210001000000000000150401210001000000000000150501210001000000000000150601210001000000000000150701210001000000000000150801210001000000000000150901210001000000000000150a01210001000000000000150b01210001000000000000150c01210001000000000000150d01210001000000000000150e01210001000000000000150f01210001000000000000151001210001000000000000151101210001000000000000151201210001000000000000151301210001000000000000151401210001000000000000151501210001000000000000151601210001000000000000151701210001000000000000151801210001000000000000151901210001000000000000151a01210001000000000000151b01210001000000000000151c01210001000000000000151d01210001000000000000151e01210001000000000000151f01210001000000000000152001210001000000000000152101210001000000000000152201210001000000000000152301210001000000000000152401210001000000000000152501210001000000000000152601210001000000000000152701210001000000000000152801210001000000000000152901210001000000000000152a01210001000000000000152b01210001000000000000152c01210001000000000000152d01210001000000000000152e01210001000000000000152f01210001000000000000153001210001000000000000153101210001000000000000153201210001000000000000153301210001000000000000153401210001000000000000153501210001000000000000153601210001000000000000153701210001000000000000153801210001000000000000153901210001000000000000153a01210001000000000000153b01210001000000000000153c01210001000000000000153d01210001000000000000153e01210001000000000000153f01210001000000000000154001210001000000000000154101210001000000000000154201210001000000000000154301210001000000000000154401210001000000000000154501210001000000000000154601210001000000000000154701210001000000000000154801210001000000000000154901210001000000000000154a01210001000000000000154b01210001000000000000154c01210001000000000000154d01210001000000000000154e01210001000000000000154f01210001000000000000155001210001000000000000155101210001000000000000155201210001000000000000155301210001000000000000155401210001000000000000155501210001000000000000155601210001000000000000155701210001000000000000155801210001000000000000155901210001000000000000155a01210001000000000000155b01210001000000000000155c01210001000000000000155d01210001000000000000155e01210001000000000000155f01210001000000000000156001210001000000000000156101210001000000000000156201210001000000000000156301210001000000000000156401210001000000000000156501210001000000000000156601210001000000000000156701210001000000000000156801210001000000000000156901210001000000000000156a01210001000000000000156b01210001000000000000156c01210001000000000000156d01210001000000000000156e01210001000000000000156f01210001000000000000157001210001000000000000157101210001000000000000157201210001000000000000157301210001000000000000157401210001000000000000157501210001000000000000157601210001000000000000157701210001000000000000157801210001000000000000157901210001000000000000157a01210001000000000000157b01210001000000000000157c01210001000000000000157d01210001000000000000157e01210001000000000000157f01210001000000000000158001210001000000000000158101210001000000000000158201210001000000000000158301210001000000000000158401210001000000000000158501210001000000000000158601210001000000000000158701210001000000000000158801210001000000000000158901210001000000000000158a01210001000000000000158b01210001000000000000158c01210001000000000000158d01210001000000000000158e01210001000000000000158f01210001000000000000159001210001000000000000159101210001000000000000159201210001000000000000159301210001000000000000159401210001000000000000159501210001000000000000159601210001000000000000159701210001000000000000159801210001000000000000159901210001000000000000159a01210001000000000000159b01210001000000000000159c01210001000000000000159d01210001000000000000159e01210001000000000000159f0121000100000000000015a00121000100000000000015a10121000100000000000015a20121000100000000000015a30121000100000000000015a40121000100000000000015a50121000100000000000015a60121000100000000000015a70121000100000000000015a80121000100000000000015a90121000100000000000015aa0121000100000000000015ab0121000100000000000015ac0121000100000000000015ad0121000100000000000015ae0121000100000000000015af0121000100000000000015b00121000100000000000015b10121000100000000000015b20121000100000000000015b30121000100000000000015b40121000100000000000015b50121000100000000000015b60121000100000000000015b70121000100000000000015b80121000100000000000015b90121000100000000000015ba0121000100000000000015bb0121000100000000000015bc0121000100000000000015bd0121000100000000000015be0121000100000000000015bf0121000100000000000015c00121000100000000000015c10121000100000000000015c20121000100000000000015c30121000100000000000015c40121000100000000000015c50121000100000000000015c60121000100000000000015c70121000100000000000015c80121000100000000000015c90121000100000000000015ca0121000100000000000015cb0121000100000000000015cc0121000100000000000015cd0121000100000000000015ce0121000100000000000015cf0121000100000000000015d00121000100000000000015d10121000100000000000015d20121000100000000000015d30121000100000000000015d40121000100000000000015d50121000100000000000015d60121000100000000000015d70121000100000000000015d80121000100000000000015d90121000100000000000015da0121000100000000000015db0121000100000000000015dc0121000100000000000015dd0121000100000000000015de0121000100000000000015df0121000100000000000015e00121000100000000000015e10121000100000000000015e20121000100000000000015e30121000100000000000015e40121000100000000000015e50121000100000000000015e60121000100000000000015e70121000100000000000015e80121000100000000000015e90121000100000000000015ea0121000100000000000015eb0121000100000000000015ec0121000100000000000015ed0121000100000000000015ee0121000100000000000015ef0121000100000000000015f00121000100000000000015f10121000100000000000015f20121000100000000000015f30121000100000000000015f40121000100000000000015f50121000100000000000015f60121000100000000000015f70121000100000000000015f80121000100000000000015f90121000100000000000015fa0121000100000000000015fb0121000100000000000015fc0121000100000000000015fd0121000100000000000015fe0121000100000000000015ff01210001000000000000160001210001000000000000160101210001000000000000160201210001000000000000160301210001000000000000160401210001000000000000160501210001000000000000160601210001000000000000160701210001000000000000160801210001000000000000160901210001000000000000160a01210001000000000000160b01210001000000000000160c01210001000000000000160d01210001000000000000160e01210001000000000000160f01210001000000000000161001210001000000000000161101210001000000000000161201210001000000000000161301210001000000000000161401210001000000000000161501210001000000000000161601210001000000000000161701210001000000000000161801210001000000000000161901210001000000000000161a01210001000000000000161b01210001000000000000161c01210001000000000000161d01210001000000000000161e01210001000000000000161f01210001000000000000162001210001000000000000162101210001000000000000162201210001000000000000162301210001000000000000162401210001000000000000162501210001000000000000162601210001000000000000162701210001000000000000162801210001000000000000162901210001000000000000162a01210001000000000000162b01210001000000000000162c01210001000000000000162d01210001000000000000162e01210001000000000000162f01210001000000000000163001210001000000000000163101210001000000000000163201210001000000000000163301210001000000000000163401210001000000000000163501210001000000000000163601210001000000000000163701210001000000000000163801210001000000000000163901210001000000000000163a01210001000000000000163b01210001000000000000163c01210001000000000000163d01210001000000000000163e01210001000000000000163f01210001000000000000164001210001000000000000164101210001000000000000164201210001000000000000164301210001000000000000164401210001000000000000164501210001000000000000164601210001000000000000164701210001000000000000164801210001000000000000164901210001000000000000164a01210001000000000000164b01210001000000000000164c01210001000000000000164d01210001000000000000164e01210001000000000000164f01210001000000000000165001210001000000000000165101210001000000000000165201210001000000000000165301210001000000000000165401210001000000000000165501210001000000000000165601210001000000000000165701210001000000000000165801210001000000000000165901210001000000000000165a01210001000000000000165b01210001000000000000165c01210001000000000000165d01210001000000000000165e01210001000000000000165f01210001000000000000166001210001000000000000166101210001000000000000166201210001000000000000166301210001000000000000166401210001000000000000166501210001000000000000166601210001000000000000166701210001000000000000166801210001000000000000166901210001000000000000166a01210001000000000000166b01210001000000000000166c01210001000000000000166d01210001000000000000166e01210001000000000000166f01210001000000000000167001210001000000000000167101210001000000000000167201210001000000000000167301210001000000000000167401210001000000000000167501210001000000000000167601210001000000000000167701210001000000000000167801210001000000000000167901210001000000000000167a01210001000000000000167b01210001000000000000167c01210001000000000000167d01210001000000000000167e01210001000000000000167f01210001000000000000168001210001000000000000168101210001000000000000168201210001000000000000168301210001000000000000168401210001000000000000168501210001000000000000168601210001000000000000168701210001000000000000168801210001000000000000168901210001000000000000168a01210001000000000000168b01210001000000000000168c01210001000000000000168d01210001000000000000168e01210001000000000000168f01210001000000000000169001210001000000000000169101210001000000000000169201210001000000000000169301210001000000000000169401210001000000000000169501210001000000000000169601210001000000000000169701210001000000000000169801210001000000000000169901210001000000000000169a01210001000000000000169b01210001000000000000169c01210001000000000000169d01210001000000000000169e01210001000000000000169f0121000100000000000016a00121000100000000000016a10121000100000000000016a20121000100000000000016a30121000100000000000016a40121000100000000000016a50121000100000000000016a60121000100000000000016a70121000100000000000016a80121000100000000000016a90121000100000000000016aa0121000100000000000016ab0121000100000000000016ac0121000100000000000016ad0121000100000000000016ae0121000100000000000016af0121000100000000000016b00121000100000000000016b10121000100000000000016b20121000100000000000016b30121000100000000000016b40121000100000000000016b50121000100000000000016b60121000100000000000016b70121000100000000000016b80121000100000000000016b90121000100000000000016ba0121000100000000000016bb0121000100000000000016bc0121000100000000000016bd0121000100000000000016be0121000100000000000016bf0121000100000000000016c00121000100000000000016c10121000100000000000016c20121000100000000000016c30121000100000000000016c40121000100000000000016c50121000100000000000016c60121000100000000000016c70121000100000000000016c80121000100000000000016c90121000100000000000016ca0121000100000000000016cb0121000100000000000016cc0121000100000000000016cd0121000100000000000016ce0121000100000000000016cf0121000100000000000016d00121000100000000000016d10121000100000000000016d20121000100000000000016d30121000100000000000016d40121000100000000000016d50121000100000000000016d60121000100000000000016d70121000100000000000016d80121000100000000000016d90121000100000000000016da0121000100000000000016db0121000100000000000016dc0121000100000000000016dd0121000100000000000016de0121000100000000000016df0121000100000000000016e00121000100000000000016e10121000100000000000016e20121000100000000000016e30121000100000000000016e40121000100000000000016e50121000100000000000016e60121000100000000000016e70121000100000000000016e80121000100000000000016e90121000100000000000016ea0121000100000000000016eb0121000100000000000016ec0121000100000000000016ed0121000100000000000016ee0121000100000000000016ef0121000100000000000016f00121000100000000000016f10121000100000000000016f20121000100000000000016f30121000100000000000016f40121000100000000000016f50121000100000000000016f60121000100000000000016f70121000100000000000016f80121000100000000000016f90121000100000000000016fa0121000100000000000016fb0121000100000000000016fc0121000100000000000016fd0121000100000000000016fe0121000100000000000016ff01210001000000000000170001210001000000000000170101210001000000000000170201210001000000000000170301210001000000000000170401210001000000000000170501210001000000000000170601210001000000000000170701210001000000000000170801210001000000000000170901210001000000000000170a01210001000000000000170b01210001000000000000170c01210001000000000000170d01210001000000000000170e01210001000000000000170f01210001000000000000171001210001000000000000171101210001000000000000171201210001000000000000171301210001000000000000171401210001000000000000171501210001000000000000171601210001000000000000171701210001000000000000171801210001000000000000171901210001000000000000171a01210001000000000000171b01210001000000000000171c01210001000000000000171d01210001000000000000171e01210001000000000000171f01210001000000000000172001210001000000000000172101210001000000000000172201210001000000000000172301210001000000000000172401210001000000000000172501210001000000000000172601210001000000000000172701210001000000000000172801210001000000000000172901210001000000000000172a01210001000000000000172b01210001000000000000172c01210001000000000000172d01210001000000000000172e01210001000000000000172f01210001000000000000173001210001000000000000173101210001000000000000173201210001000000000000173301210001000000000000173401210001000000000000173501210001000000000000173601210001000000000000173701210001000000000000173801210001000000000000173901210001000000000000173a01210001000000000000173b01210001000000000000173c01210001000000000000173d01210001000000000000173e01210001000000000000173f01210001000000000000174001210001000000000000174101210001000000000000174201210001000000000000174301210001000000000000174401210001000000000000174501210001000000000000174601210001000000000000174701210001000000000000174801210001000000000000174901210001000000000000174a01210001000000000000174b01210001000000000000174c01210001000000000000174d01210001000000000000174e01210001000000000000174f01210001000000000000175001210001000000000000175101210001000000000000175201210001000000000000175301210001000000000000175401210001000000000000175501210001000000000000175601210001000000000000175701210001000000000000175801210001000000000000175901210001000000000000175a01210001000000000000175b01210001000000000000175c01210001000000000000175d01210001000000000000175e01210001000000000000175f01210001000000000000176001210001000000000000176101210001000000000000176201210001000000000000176301210001000000000000176401210001000000000000176501210001000000000000176601210001000000000000176701210001000000000000176801210001000000000000176901210001000000000000176a01210001000000000000176b01210001000000000000176c01210001000000000000176d01210001000000000000176e01210001000000000000176f01210001000000000000177001210001000000000000177101210001000000000000177201210001000000000000177301210001000000000000177401210001000000000000177501210001000000000000177601210001000000000000177701210001000000000000177801210001000000000000177901210001000000000000177a01210001000000000000177b01210001000000000000177c01210001000000000000177d01210001000000000000177e01210001000000000000177f01210001000000000000178001210001000000000000178101210001000000000000178201210001000000000000178301210001000000000000178401210001000000000000178501210001000000000000178601210001000000000000178701210001000000000000178801210001000000000000178901210001000000000000178a01210001000000000000178b01210001000000000000178c01210001000000000000178d01210001000000000000178e01210001000000000000178f01210001000000000000179001210001000000000000179101210001000000000000179201210001000000000000179301210001000000000000179401210001000000000000179501210001000000000000179601210001000000000000179701210001000000000000179801210001000000000000179901210001000000000000179a01210001000000000000179b01210001000000000000179c01210001000000000000179d01210001000000000000179e01210001000000000000179f0121000100000000000017a00121000100000000000017a10121000100000000000017a20121000100000000000017a30121000100000000000017a40121000100000000000017a50121000100000000000017a60121000100000000000017a70121000100000000000017a80121000100000000000017a90121000100000000000017aa0121000100000000000017ab0121000100000000000017ac0121000100000000000017ad0121000100000000000017ae0121000100000000000017af0121000100000000000017b00121000100000000000017b10121000100000000000017b20121000100000000000017b30121000100000000000017b40121000100000000000017b50121000100000000000017b60121000100000000000017b70121000100000000000017b80121000100000000000017b90121000100000000000017ba0121000100000000000017bb0121000100000000000017bc0121000100000000000017bd0121000100000000000017be0121000100000000000017bf0121000100000000000017c00121000100000000000017c10121000100000000000017c20121000100000000000017c30121000100000000000017c40121000100000000000017c50121000100000000000017c60121000100000000000017c70121000100000000000017c80121000100000000000017c90121000100000000000017ca0121000100000000000017cb0121000100000000000017cc0121000100000000000017cd0121000100000000000017ce0121000100000000000017cf0121000100000000000017d00121000100000000000017d10121000100000000000017d20121000100000000000017d30121000100000000000017d40121000100000000000017d50121000100000000000017d60121000100000000000017d70121000100000000000017d80121000100000000000017d90121000100000000000017da0121000100000000000017db0121000100000000000017dc0121000100000000000017dd0121000100000000000017de0121000100000000000017df0121000100000000000017e00121000100000000000017e10121000100000000000017e20121000100000000000017e30121000100000000000017e40121000100000000000017e50121000100000000000017e60121000100000000000017e70121000100000000000017e80121000100000000000017e90121000100000000000017ea0121000100000000000017eb0121000100000000000017ec0121000100000000000017ed0121000100000000000017ee0121000100000000000017ef0121000100000000000017f00121000100000000000017f10121000100000000000017f20121000100000000000017f30121000100000000000017f40121000100000000000017f50121000100000000000017f60121000100000000000017f70121000100000000000017f80121000100000000000017f90121000100000000000017fa0121000100000000000017fb0121000100000000000017fc0121000100000000000017fd0121000100000000000017fe0121000100000000000017ff01210001000000000000180001210001000000000000180101210001000000000000180201210001000000000000180301210001000000000000180401210001000000000000180501210001000000000000180601210001000000000000180701210001000000000000180801210001000000000000180901210001000000000000180a01210001000000000000180b01210001000000000000180c01210001000000000000180d01210001000000000000180e01210001000000000000180f01210001000000000000181001210001000000000000181101210001000000000000181201210001000000000000181301210001000000000000181401210001000000000000181501210001000000000000181601210001000000000000181701210001000000000000181801210001000000000000181901210001000000000000181a01210001000000000000181b01210001000000000000181c01210001000000000000181d01210001000000000000181e01210001000000000000181f01210001000000000000182001210001000000000000182101210001000000000000182201210001000000000000182301210001000000000000182401210001000000000000182501210001000000000000182601210001000000000000182701210001000000000000182801210001000000000000182901210001000000000000182a01210001000000000000182b01210001000000000000182c01210001000000000000182d01210001000000000000182e01210001000000000000182f01210001000000000000183001210001000000000000183101210001000000000000183201210001000000000000183301210001000000000000183401210001000000000000183501210001000000000000183601210001000000000000183701210001000000000000183801210001000000000000183901210001000000000000183a01210001000000000000183b01210001000000000000183c01210001000000000000183d01210001000000000000183e01210001000000000000183f01210001000000000000184001210001000000000000184101210001000000000000184201210001000000000000184301210001000000000000184401210001000000000000184501210001000000000000184601210001000000000000184701210001000000000000184801210001000000000000184901210001000000000000184a01210001000000000000184b01210001000000000000184c01210001000000000000184d01210001000000000000184e01210001000000000000184f01210001000000000000185001210001000000000000185101210001000000000000185201210001000000000000185301210001000000000000185401210001000000000000185501210001000000000000185601210001000000000000185701210001000000000000185801210001000000000000185901210001000000000000185a01210001000000000000185b01210001000000000000185c01210001000000000000185d01210001000000000000185e01210001000000000000185f01210001000000000000186001210001000000000000186101210001000000000000186201210001000000000000186301210001000000000000186401210001000000000000186501210001000000000000186601210001000000000000186701210001000000000000186801210001000000000000186901210001000000000000186a01210001000000000000186b01210001000000000000186c01210001000000000000186d01210001000000000000186e01210001000000000000186f01210001000000000000187001210001000000000000187101210001000000000000187201210001000000000000187301210001000000000000187401210001000000000000187501210001000000000000187601210001000000000000187701210001000000000000187801210001000000000000187901210001000000000000187a01210001000000000000187b01210001000000000000187c01210001000000000000187d01210001000000000000187e01210001000000000000187f01210001000000000000188001210001000000000000188101210001000000000000188201210001000000000000188301210001000000000000188401210001000000000000188501210001000000000000188601210001000000000000188701210001000000000000188801210001000000000000188901210001000000000000188a01210001000000000000188b01210001000000000000188c01210001000000000000188d01210001000000000000188e01210001000000000000188f01210001000000000000189001210001000000000000189101210001000000000000189201210001000000000000189301210001000000000000189401210001000000000000189501210001000000000000189601210001000000000000189701210001000000000000189801210001000000000000189901210001000000000000189a01210001000000000000189b01210001000000000000189c01210001000000000000189d01210001000000000000189e01210001000000000000189f0121000100000000000018a00121000100000000000018a10121000100000000000018a20121000100000000000018a30121000100000000000018a40121000100000000000018a50121000100000000000018a60121000100000000000018a70121000100000000000018a80121000100000000000018a90121000100000000000018aa0121000100000000000018ab0121000100000000000018ac0121000100000000000018ad0121000100000000000018ae0121000100000000000018af0121000100000000000018b00121000100000000000018b10121000100000000000018b20121000100000000000018b30121000100000000000018b40121000100000000000018b50121000100000000000018b60121000100000000000018b70121000100000000000018b80121000100000000000018b90121000100000000000018ba0121000100000000000018bb0121000100000000000018bc0121000100000000000018bd0121000100000000000018be0121000100000000000018bf0121000100000000000018c00121000100000000000018c10121000100000000000018c20121000100000000000018c30121000100000000000018c40121000100000000000018c50121000100000000000018c60121000100000000000018c70121000100000000000018c80121000100000000000018c90121000100000000000018ca0121000100000000000018cb0121000100000000000018cc0121000100000000000018cd0121000100000000000018ce0121000100000000000018cf0121000100000000000018d00121000100000000000018d10121000100000000000018d20121000100000000000018d30121000100000000000018d40121000100000000000018d50121000100000000000018d60121000100000000000018d70121000100000000000018d80121000100000000000018d90121000100000000000018da0121000100000000000018db0121000100000000000018dc0121000100000000000018dd0121000100000000000018de0121000100000000000018df0121000100000000000018e00121000100000000000018e10121000100000000000018e20121000100000000000018e30121000100000000000018e40121000100000000000018e50121000100000000000018e60121000100000000000018e70121000100000000000018e80121000100000000000018e90121000100000000000018ea0121000100000000000018eb0121000100000000000018ec0121000100000000000018ed0121000100000000000018ee0121000100000000000018ef0121000100000000000018f00121000100000000000018f10121000100000000000018f20121000100000000000018f30121000100000000000018f40121000100000000000018f50121000100000000000018f60121000100000000000018f70121000100000000000018f80121000100000000000018f90121000100000000000018fa0121000100000000000018fb0121000100000000000018fc0121000100000000000018fd0121000100000000000018fe0121000100000000000018ff01210001000000000000190001210001000000000000190101210001000000000000190201210001000000000000190301210001000000000000190401210001000000000000190501210001000000000000190601210001000000000000190701210001000000000000190801210001000000000000190901210001000000000000190a01210001000000000000190b01210001000000000000190c01210001000000000000190d01210001000000000000190e01210001000000000000190f01210001000000000000191001210001000000000000191101210001000000000000191201210001000000000000191301210001000000000000191401210001000000000000191501210001000000000000191601210001000000000000191701210001000000000000191801210001000000000000191901210001000000000000191a01210001000000000000191b01210001000000000000191c01210001000000000000191d01210001000000000000191e01210001000000000000191f01210001000000000000192001210001000000000000192101210001000000000000192201210001000000000000192301210001000000000000192401210001000000000000192501210001000000000000192601210001000000000000192701210001000000000000192801210001000000000000192901210001000000000000192a01210001000000000000192b01210001000000000000192c01210001000000000000192d01210001000000000000192e01210001000000000000192f01210001000000000000193001210001000000000000193101210001000000000000193201210001000000000000193301210001000000000000193401210001000000000000193501210001000000000000193601210001000000000000193701210001000000000000193801210001000000000000193901210001000000000000193a01210001000000000000193b01210001000000000000193c01210001000000000000193d01210001000000000000193e01210001000000000000193f01210001000000000000194001210001000000000000194101210001000000000000194201210001000000000000194301210001000000000000194401210001000000000000194501210001000000000000194601210001000000000000194701210001000000000000194801210001000000000000194901210001000000000000194a01210001000000000000194b01210001000000000000194c01210001000000000000194d01210001000000000000194e01210001000000000000194f01210001000000000000195001210001000000000000195101210001000000000000195201210001000000000000195301210001000000000000195401210001000000000000195501210001000000000000195601210001000000000000195701210001000000000000195801210001000000000000195901210001000000000000195a01210001000000000000195b01210001000000000000195c01210001000000000000195d01210001000000000000195e01210001000000000000195f01210001000000000000196001210001000000000000196101210001000000000000196201210001000000000000196301210001000000000000196401210001000000000000196501210001000000000000196601210001000000000000196701210001000000000000196801210001000000000000196901210001000000000000196a01210001000000000000196b01210001000000000000196c01210001000000000000196d01210001000000000000196e01210001000000000000196f01210001000000000000197001210001000000000000197101210001000000000000197201210001000000000000197301210001000000000000197401210001000000000000197501210001000000000000197601210001000000000000197701210001000000000000197801210001000000000000197901210001000000000000197a01210001000000000000197b01210001000000000000197c01210001000000000000197d01210001000000000000197e01210001000000000000197f01210001000000000000198001210001000000000000198101210001000000000000198201210001000000000000198301210001000000000000198401210001000000000000198501210001000000000000198601210001000000000000198701210001000000000000198801210001000000000000198901210001000000000000198a01210001000000000000198b01210001000000000000198c01210001000000000000198d01210001000000000000198e01210001000000000000198f01210001000000000000199001210001000000000000199101210001000000000000199201210001000000000000199301210001000000000000199401210001000000000000199501210001000000000000199601210001000000000000199701210001000000000000199801210001000000000000199901210001000000000000199a01210001000000000000199b01210001000000000000199c01210001000000000000199d01210001000000000000199e01210001000000000000199f0121000100000000000019a00121000100000000000019a10121000100000000000019a20121000100000000000019a30121000100000000000019a40121000100000000000019a50121000100000000000019a60121000100000000000019a70121000100000000000019a80121000100000000000019a90121000100000000000019aa0121000100000000000019ab0121000100000000000019ac0121000100000000000019ad0121000100000000000019ae0121000100000000000019af0121000100000000000019b00121000100000000000019b10121000100000000000019b20121000100000000000019b30121000100000000000019b40121000100000000000019b50121000100000000000019b60121000100000000000019b70121000100000000000019b80121000100000000000019b90121000100000000000019ba0121000100000000000019bb0121000100000000000019bc0121000100000000000019bd0121000100000000000019be0121000100000000000019bf0121000100000000000019c00121000100000000000019c10121000100000000000019c20121000100000000000019c30121000100000000000019c40121000100000000000019c50121000100000000000019c60121000100000000000019c70121000100000000000019c80121000100000000000019c90121000100000000000019ca0121000100000000000019cb0121000100000000000019cc0121000100000000000019cd0121000100000000000019ce0121000100000000000019cf0121000100000000000019d00121000100000000000019d10121000100000000000019d20121000100000000000019d30121000100000000000019d40121000100000000000019d50121000100000000000019d60121000100000000000019d70121000100000000000019d80121000100000000000019d90121000100000000000019da0121000100000000000019db0121000100000000000019dc0121000100000000000019dd0121000100000000000019de0121000100000000000019df0121000100000000000019e00121000100000000000019e10121000100000000000019e20121000100000000000019e30121000100000000000019e40121000100000000000019e50121000100000000000019e60121000100000000000019e70121000100000000000019e80121000100000000000019e90121000100000000000019ea0121000100000000000019eb0121000100000000000019ec0121000100000000000019ed0121000100000000000019ee0121000100000000000019ef0121000100000000000019f00121000100000000000019f10121000100000000000019f20121000100000000000019f30121000100000000000019f40121000100000000000019f50121000100000000000019f60121000100000000000019f70121000100000000000019f80121000100000000000019f90121000100000000000019fa0121000100000000000019fb0121000100000000000019fc0121000100000000000019fd0121000100000000000019fe0121000100000000000019ff012100010000000000001a00012100010000000000001a01012100010000000000001a02012100010000000000001a03012100010000000000001a04012100010000000000001a05012100010000000000001a06012100010000000000001a07012100010000000000001a08012100010000000000001a09012100010000000000001a0a012100010000000000001a0b012100010000000000001a0c012100010000000000001a0d012100010000000000001a0e012100010000000000001a0f012100010000000000001a10012100010000000000001a11012100010000000000001a12012100010000000000001a13012100010000000000001a14012100010000000000001a15012100010000000000001a16012100010000000000001a17012100010000000000001a18012100010000000000001a19012100010000000000001a1a012100010000000000001a1b012100010000000000001a1c012100010000000000001a1d012100010000000000001a1e012100010000000000001a1f012100010000000000001a20012100010000000000001a21012100010000000000001a22012100010000000000001a23012100010000000000001a24012100010000000000001a25012100010000000000001a26012100010000000000001a27012100010000000000001a28012100010000000000001a29012100010000000000001a2a012100010000000000001a2b012100010000000000001a2c012100010000000000001a2d012100010000000000001a2e012100010000000000001a2f012100010000000000001a30012100010000000000001a31012100010000000000001a32012100010000000000001a33012100010000000000001a34012100010000000000001a35012100010000000000001a36012100010000000000001a37012100010000000000001a38012100010000000000001a39012100010000000000001a3a012100010000000000001a3b012100010000000000001a3c012100010000000000001a3d012100010000000000001a3e012100010000000000001a3f012100010000000000001a40012100010000000000001a41012100010000000000001a42012100010000000000001a43012100010000000000001a44012100010000000000001a45012100010000000000001a46012100010000000000001a47012100010000000000001a48012100010000000000001a49012100010000000000001a4a012100010000000000001a4b012100010000000000001a4c012100010000000000001a4d012100010000000000001a4e012100010000000000001a4f012100010000000000001a50012100010000000000001a51012100010000000000001a52012100010000000000001a53012100010000000000001a54012100010000000000001a55012100010000000000001a56012100010000000000001a57012100010000000000001a58012100010000000000001a59012100010000000000001a5a012100010000000000001a5b012100010000000000001a5c012100010000000000001a5d012100010000000000001a5e012100010000000000001a5f012100010000000000001a60012100010000000000001a61012100010000000000001a62012100010000000000001a63012100010000000000001a64012100010000000000001a65012100010000000000001a66012100010000000000001a67012100010000000000001a68012100010000000000001a69012100010000000000001a6a012100010000000000001a6b012100010000000000001a6c012100010000000000001a6d012100010000000000001a6e012100010000000000001a6f012100010000000000001a70012100010000000000001a71012100010000000000001a72012100010000000000001a73012100010000000000001a74012100010000000000001a75012100010000000000001a76012100010000000000001a77012100010000000000001a78012100010000000000001a79012100010000000000001a7a012100010000000000001a7b012100010000000000001a7c012100010000000000001a7d012100010000000000001a7e012100010000000000001a7f012100010000000000001a80012100010000000000001a81012100010000000000001a82012100010000000000001a83012100010000000000001a84012100010000000000001a85012100010000000000001a86012100010000000000001a87012100010000000000001a88012100010000000000001a89012100010000000000001a8a012100010000000000001a8b012100010000000000001a8c012100010000000000001a8d012100010000000000001a8e012100010000000000001a8f012100010000000000001a90012100010000000000001a91012100010000000000001a92012100010000000000001a93012100010000000000001a94012100010000000000001a95012100010000000000001a96012100010000000000001a97012100010000000000001a98012100010000000000001a99012100010000000000001a9a012100010000000000001a9b012100010000000000001a9c012100010000000000001a9d012100010000000000001a9e012100010000000000001a9f012100010000000000001aa0012100010000000000001aa1012100010000000000001aa2012100010000000000001aa3012100010000000000001aa4012100010000000000001aa5012100010000000000001aa6012100010000000000001aa7012100010000000000001aa8012100010000000000001aa9012100010000000000001aaa012100010000000000001aab012100010000000000001aac012100010000000000001aad012100010000000000001aae012100010000000000001aaf012100010000000000001ab0012100010000000000001ab1012100010000000000001ab2012100010000000000001ab3012100010000000000001ab4012100010000000000001ab5012100010000000000001ab6012100010000000000001ab7012100010000000000001ab8012100010000000000001ab9012100010000000000001aba012100010000000000001abb012100010000000000001abc012100010000000000001abd012100010000000000001abe012100010000000000001abf012100010000000000001ac0012100010000000000001ac1012100010000000000001ac2012100010000000000001ac3012100010000000000001ac4012100010000000000001ac5012100010000000000001ac6012100010000000000001ac7012100010000000000001ac8012100010000000000001ac9012100010000000000001aca012100010000000000001acb012100010000000000001acc012100010000000000001acd012100010000000000001ace012100010000000000001acf012100010000000000001ad0012100010000000000001ad1012100010000000000001ad2012100010000000000001ad3012100010000000000001ad4012100010000000000001ad5012100010000000000001ad6012100010000000000001ad7012100010000000000001ad8012100010000000000001ad9012100010000000000001ada012100010000000000001adb012100010000000000001adc012100010000000000001add012100010000000000001ade012100010000000000001adf012100010000000000001ae0012100010000000000001ae1012100010000000000001ae2012100010000000000001ae3012100010000000000001ae4012100010000000000001ae5012100010000000000001ae6012100010000000000001ae7012100010000000000001ae8012100010000000000001ae9012100010000000000001aea012100010000000000001aeb012100010000000000001aec012100010000000000001aed012100010000000000001aee012100010000000000001aef012100010000000000001af0012100010000000000001af1012100010000000000001af2012100010000000000001af3012100010000000000001af4012100010000000000001af5012100010000000000001af6012100010000000000001af7012100010000000000001af8012100010000000000001af9012100010000000000001afa012100010000000000001afb012100010000000000001afc012100010000000000001afd012100010000000000001afe012100010000000000001aff012100010000000000001b00012100010000000000001b01012100010000000000001b02012100010000000000001b03012100010000000000001b04012100010000000000001b05012100010000000000001b06012100010000000000001b07012100010000000000001b08012100010000000000001b09012100010000000000001b0a012100010000000000001b0b012100010000000000001b0c012100010000000000001b0d012100010000000000001b0e012100010000000000001b0f012100010000000000001b10012100010000000000001b11012100010000000000001b12012100010000000000001b13012100010000000000001b14012100010000000000001b15012100010000000000001b16012100010000000000001b17012100010000000000001b18012100010000000000001b19012100010000000000001b1a012100010000000000001b1b012100010000000000001b1c012100010000000000001b1d012100010000000000001b1e012100010000000000001b1f012100010000000000001b20012100010000000000001b21012100010000000000001b22012100010000000000001b23012100010000000000001b24012100010000000000001b25012100010000000000001b26012100010000000000001b27012100010000000000001b28012100010000000000001b29012100010000000000001b2a012100010000000000001b2b012100010000000000001b2c012100010000000000001b2d012100010000000000001b2e012100010000000000001b2f012100010000000000001b30012100010000000000001b31012100010000000000001b32012100010000000000001b33012100010000000000001b34012100010000000000001b35012100010000000000001b36012100010000000000001b37012100010000000000001b38012100010000000000001b39012100010000000000001b3a012100010000000000001b3b012100010000000000001b3c012100010000000000001b3d012100010000000000001b3e012100010000000000001b3f012100010000000000001b40012100010000000000001b41012100010000000000001b42012100010000000000001b43012100010000000000001b44012100010000000000001b45012100010000000000001b46012100010000000000001b47012100010000000000001b48012100010000000000001b49012100010000000000001b4a012100010000000000001b4b012100010000000000001b4c012100010000000000001b4d012100010000000000001b4e012100010000000000001b4f012100010000000000001b50012100010000000000001b51012100010000000000001b52012100010000000000001b53012100010000000000001b54012100010000000000001b55012100010000000000001b56012100010000000000001b57012100010000000000001b58012100010000000000001b59012100010000000000001b5a012100010000000000001b5b012100010000000000001b5c012100010000000000001b5d012100010000000000001b5e012100010000000000001b5f012100010000000000001b60012100010000000000001b61012100010000000000001b62012100010000000000001b63012100010000000000001b64012100010000000000001b65012100010000000000001b66012100010000000000001b67012100010000000000001b68012100010000000000001b69012100010000000000001b6a012100010000000000001b6b012100010000000000001b6c012100010000000000001b6d012100010000000000001b6e012100010000000000001b6f012100010000000000001b70012100010000000000001b71012100010000000000001b72012100010000000000001b73012100010000000000001b74012100010000000000001b75012100010000000000001b76012100010000000000001b77012100010000000000001b78012100010000000000001b79012100010000000000001b7a012100010000000000001b7b012100010000000000001b7c012100010000000000001b7d012100010000000000001b7e012100010000000000001b7f012100010000000000001b80012100010000000000001b81012100010000000000001b82012100010000000000001b83012100010000000000001b84012100010000000000001b85012100010000000000001b86012100010000000000001b87012100010000000000001b88012100010000000000001b89012100010000000000001b8a012100010000000000001b8b012100010000000000001b8c012100010000000000001b8d012100010000000000001b8e012100010000000000001b8f012100010000000000001b90012100010000000000001b91012100010000000000001b92012100010000000000001b93012100010000000000001b94012100010000000000001b95012100010000000000001b96012100010000000000001b97012100010000000000001b98012100010000000000001b99012100010000000000001b9a012100010000000000001b9b012100010000000000001b9c012100010000000000001b9d012100010000000000001b9e012100010000000000001b9f012100010000000000001ba0012100010000000000001ba1012100010000000000001ba2012100010000000000001ba3012100010000000000001ba4012100010000000000001ba5012100010000000000001ba6012100010000000000001ba7012100010000000000001ba8012100010000000000001ba9012100010000000000001baa012100010000000000001bab012100010000000000001bac012100010000000000001bad012100010000000000001bae012100010000000000001baf012100010000000000001bb0012100010000000000001bb1012100010000000000001bb2012100010000000000001bb3012100010000000000001bb4012100010000000000001bb5012100010000000000001bb6012100010000000000001bb7012100010000000000001bb8012100010000000000001bb9012100010000000000001bba012100010000000000001bbb012100010000000000001bbc012100010000000000001bbd012100010000000000001bbe012100010000000000001bbf012100010000000000001bc0012100010000000000001bc1012100010000000000001bc2012100010000000000001bc3012100010000000000001bc4012100010000000000001bc5012100010000000000001bc6012100010000000000001bc7012100010000000000001bc8012100010000000000001bc9012100010000000000001bca012100010000000000001bcb012100010000000000001bcc012100010000000000001bcd012100010000000000001bce012100010000000000001bcf012100010000000000001bd0012100010000000000001bd1012100010000000000001bd2012100010000000000001bd3012100010000000000001bd4012100010000000000001bd5012100010000000000001bd6012100010000000000001bd7012100010000000000001bd8012100010000000000001bd9012100010000000000001bda012100010000000000001bdb012100010000000000001bdc012100010000000000001bdd012100010000000000001bde012100010000000000001bdf012100010000000000001be0012100010000000000001be1012100010000000000001be2012100010000000000001be3012100010000000000001be4012100010000000000001be5012100010000000000001be6012100010000000000001be7012100010000000000001be8012100010000000000001be9012100010000000000001bea012100010000000000001beb012100010000000000001bec012100010000000000001bed012100010000000000001bee012100010000000000001bef012100010000000000001bf0012100010000000000001bf1012100010000000000001bf2012100010000000000001bf3012100010000000000001bf4012100010000000000001bf5012100010000000000001bf6012100010000000000001bf7012100010000000000001bf8012100010000000000001bf9012100010000000000001bfa012100010000000000001bfb012100010000000000001bfc012100010000000000001bfd012100010000000000001bfe012100010000000000001bff012100010000000000001c00012100010000000000001c01012100010000000000001c02012100010000000000001c03012100010000000000001c04012100010000000000001c05012100010000000000001c06012100010000000000001c07012100010000000000001c08012100010000000000001c09012100010000000000001c0a012100010000000000001c0b012100010000000000001c0c012100010000000000001c0d012100010000000000001c0e012100010000000000001c0f012100010000000000001c10012100010000000000001c11012100010000000000001c12012100010000000000001c13012100010000000000001c14012100010000000000001c15012100010000000000001c16012100010000000000001c17012100010000000000001c18012100010000000000001c19012100010000000000001c1a012100010000000000001c1b012100010000000000001c1c012100010000000000001c1d012100010000000000001c1e012100010000000000001c1f012100010000000000001c20012100010000000000001c21012100010000000000001c22012100010000000000001c23012100010000000000001c24012100010000000000001c25012100010000000000001c26012100010000000000001c27012100010000000000001c28012100010000000000001c29012100010000000000001c2a012100010000000000001c2b012100010000000000001c2c012100010000000000001c2d012100010000000000001c2e012100010000000000001c2f012100010000000000001c30012100010000000000001c31012100010000000000001c32012100010000000000001c33012100010000000000001c34012100010000000000001c35012100010000000000001c36012100010000000000001c37012100010000000000001c38012100010000000000001c39012100010000000000001c3a012100010000000000001c3b012100010000000000001c3c012100010000000000001c3d012100010000000000001c3e012100010000000000001c3f012100010000000000001c40012100010000000000001c41012100010000000000001c42012100010000000000001c43012100010000000000001c44012100010000000000001c45012100010000000000001c46012100010000000000001c47012100010000000000001c48012100010000000000001c49012100010000000000001c4a012100010000000000001c4b012100010000000000001c4c012100010000000000001c4d012100010000000000001c4e012100010000000000001c4f012100010000000000001c50012100010000000000001c51012100010000000000001c52012100010000000000001c53012100010000000000001c54012100010000000000001c55012100010000000000001c56012100010000000000001c57012100010000000000001c58012100010000000000001c59012100010000000000001c5a012100010000000000001c5b012100010000000000001c5c012100010000000000001c5d012100010000000000001c5e012100010000000000001c5f012100010000000000001c60012100010000000000001c61012100010000000000001c62012100010000000000001c63012100010000000000001c64012100010000000000001c65012100010000000000001c66012100010000000000001c67012100010000000000001c68012100010000000000001c69012100010000000000001c6a012100010000000000001c6b012100010000000000001c6c012100010000000000001c6d012100010000000000001c6e012100010000000000001c6f012100010000000000001c70012100010000000000001c71012100010000000000001c72012100010000000000001c73012100010000000000001c74012100010000000000001c75012100010000000000001c76012100010000000000001c77012100010000000000001c78012100010000000000001c79012100010000000000001c7a012100010000000000001c7b012100010000000000001c7c012100010000000000001c7d012100010000000000001c7e012100010000000000001c7f012100010000000000001c80012100010000000000001c81012100010000000000001c82012100010000000000001c83012100010000000000001c84012100010000000000001c85012100010000000000001c86012100010000000000001c87012100010000000000001c88012100010000000000001c89012100010000000000001c8a012100010000000000001c8b012100010000000000001c8c012100010000000000001c8d012100010000000000001c8e012100010000000000001c8f012100010000000000001c90012100010000000000001c91012100010000000000001c92012100010000000000001c93012100010000000000001c94012100010000000000001c95012100010000000000001c96012100010000000000001c97012100010000000000001c98012100010000000000001c99012100010000000000001c9a012100010000000000001c9b012100010000000000001c9c012100010000000000001c9d012100010000000000001c9e012100010000000000001c9f012100010000000000001ca0012100010000000000001ca1012100010000000000001ca2012100010000000000001ca3012100010000000000001ca4012100010000000000001ca5012100010000000000001ca6012100010000000000001ca7012100010000000000001ca8012100010000000000001ca9012100010000000000001caa012100010000000000001cab012100010000000000001cac012100010000000000001cad012100010000000000001cae012100010000000000001caf012100010000000000001cb0012100010000000000001cb1012100010000000000001cb2012100010000000000001cb3012100010000000000001cb4012100010000000000001cb5012100010000000000001cb6012100010000000000001cb7012100010000000000001cb8012100010000000000001cb9012100010000000000001cba012100010000000000001cbb012100010000000000001cbc012100010000000000001cbd012100010000000000001cbe012100010000000000001cbf012100010000000000001cc0012100010000000000001cc1012100010000000000001cc2012100010000000000001cc3012100010000000000001cc4012100010000000000001cc5012100010000000000001cc6012100010000000000001cc7012100010000000000001cc8012100010000000000001cc9012100010000000000001cca012100010000000000001ccb012100010000000000001ccc012100010000000000001ccd012100010000000000001cce012100010000000000001ccf012100010000000000001cd0012100010000000000001cd1012100010000000000001cd2012100010000000000001cd3012100010000000000001cd4012100010000000000001cd5012100010000000000001cd6012100010000000000001cd7012100010000000000001cd8012100010000000000001cd9012100010000000000001cda012100010000000000001cdb012100010000000000001cdc012100010000000000001cdd012100010000000000001cde012100010000000000001cdf012100010000000000001ce0012100010000000000001ce1012100010000000000001ce2012100010000000000001ce3012100010000000000001ce4012100010000000000001ce5012100010000000000001ce6012100010000000000001ce7012100010000000000001ce8012100010000000000001ce9012100010000000000001cea012100010000000000001ceb012100010000000000001cec012100010000000000001ced012100010000000000001cee012100010000000000001cef012100010000000000001cf0012100010000000000001cf1012100010000000000001cf2012100010000000000001cf3012100010000000000001cf4012100010000000000001cf5012100010000000000001cf6012100010000000000001cf7012100010000000000001cf8012100010000000000001cf9012100010000000000001cfa012100010000000000001cfb012100010000000000001cfc012100010000000000001cfd012100010000000000001cfe012100010000000000001cff012100010000000000001d00012100010000000000001d01012100010000000000001d02012100010000000000001d03012100010000000000001d04012100010000000000001d05012100010000000000001d06012100010000000000001d07012100010000000000001d08012100010000000000001d09012100010000000000001d0a012100010000000000001d0b012100010000000000001d0c012100010000000000001d0d012100010000000000001d0e012100010000000000001d0f012100010000000000001d10012100010000000000001d11012100010000000000001d12012100010000000000001d13012100010000000000001d14012100010000000000001d15012100010000000000001d16012100010000000000001d17012100010000000000001d18012100010000000000001d19012100010000000000001d1a012100010000000000001d1b012100010000000000001d1c012100010000000000001d1d012100010000000000001d1e012100010000000000001d1f012100010000000000001d20012100010000000000001d21012100010000000000001d22012100010000000000001d23012100010000000000001d24012100010000000000001d25012100010000000000001d26012100010000000000001d27012100010000000000001d28012100010000000000001d29012100010000000000001d2a012100010000000000001d2b012100010000000000001d2c012100010000000000001d2d012100010000000000001d2e012100010000000000001d2f012100010000000000001d30012100010000000000001d31012100010000000000001d32012100010000000000001d33012100010000000000001d34012100010000000000001d35012100010000000000001d36012100010000000000001d37012100010000000000001d38012100010000000000001d39012100010000000000001d3a012100010000000000001d3b012100010000000000001d3c012100010000000000001d3d012100010000000000001d3e012100010000000000001d3f012100010000000000001d40012100010000000000001d41012100010000000000001d42012100010000000000001d43012100010000000000001d44012100010000000000001d45012100010000000000001d46012100010000000000001d47012100010000000000001d48012100010000000000001d49012100010000000000001d4a012100010000000000001d4b012100010000000000001d4c012100010000000000001d4d012100010000000000001d4e012100010000000000001d4f012100010000000000001d50012100010000000000001d51012100010000000000001d52012100010000000000001d53012100010000000000001d54012100010000000000001d55012100010000000000001d56012100010000000000001d57012100010000000000001d58012100010000000000001d59012100010000000000001d5a012100010000000000001d5b012100010000000000001d5c012100010000000000001d5d012100010000000000001d5e012100010000000000001d5f012100010000000000001d60012100010000000000001d61012100010000000000001d62012100010000000000001d63012100010000000000001d64012100010000000000001d65012100010000000000001d66012100010000000000001d67012100010000000000001d68012100010000000000001d69012100010000000000001d6a012100010000000000001d6b012100010000000000001d6c012100010000000000001d6d012100010000000000001d6e012100010000000000001d6f012100010000000000001d70012100010000000000001d71012100010000000000001d72012100010000000000001d73012100010000000000001d74012100010000000000001d75012100010000000000001d76012100010000000000001d77012100010000000000001d78012100010000000000001d79012100010000000000001d7a012100010000000000001d7b012100010000000000001d7c012100010000000000001d7d012100010000000000001d7e012100010000000000001d7f012100010000000000001d80012100010000000000001d81012100010000000000001d82012100010000000000001d83012100010000000000001d84012100010000000000001d85012100010000000000001d86012100010000000000001d87012100010000000000001d88012100010000000000001d89012100010000000000001d8a012100010000000000001d8b012100010000000000001d8c012100010000000000001d8d012100010000000000001d8e012100010000000000001d8f012100010000000000001d90012100010000000000001d91012100010000000000001d92012100010000000000001d93012100010000000000001d94012100010000000000001d95012100010000000000001d96012100010000000000001d97012100010000000000001d98012100010000000000001d99012100010000000000001d9a012100010000000000001d9b012100010000000000001d9c012100010000000000001d9d012100010000000000001d9e012100010000000000001d9f012100010000000000001da0012100010000000000001da1012100010000000000001da2012100010000000000001da3012100010000000000001da4012100010000000000001da5012100010000000000001da6012100010000000000001da7012100010000000000001da8012100010000000000001da9012100010000000000001daa012100010000000000001dab012100010000000000001dac012100010000000000001dad012100010000000000001dae012100010000000000001daf012100010000000000001db0012100010000000000001db1012100010000000000001db2012100010000000000001db3012100010000000000001db4012100010000000000001db5012100010000000000001db6012100010000000000001db7012100010000000000001db8012100010000000000001db9012100010000000000001dba012100010000000000001dbb012100010000000000001dbc012100010000000000001dbd012100010000000000001dbe012100010000000000001dbf012100010000000000001dc0012100010000000000001dc1012100010000000000001dc2012100010000000000001dc3012100010000000000001dc4012100010000000000001dc5012100010000000000001dc6012100010000000000001dc7012100010000000000001dc8012100010000000000001dc9012100010000000000001dca012100010000000000001dcb012100010000000000001dcc012100010000000000001dcd012100010000000000001dce012100010000000000001dcf012100010000000000001dd0012100010000000000001dd1012100010000000000001dd2012100010000000000001dd3012100010000000000001dd4012100010000000000001dd5012100010000000000001dd6012100010000000000001dd7012100010000000000001dd8012100010000000000001dd9012100010000000000001dda012100010000000000001ddb012100010000000000001ddc012100010000000000001ddd012100010000000000001dde012100010000000000001ddf012100010000000000001de0012100010000000000001de1012100010000000000001de2012100010000000000001de3012100010000000000001de4012100010000000000001de5012100010000000000001de6012100010000000000001de7012100010000000000001de8012100010000000000001de9012100010000000000001dea012100010000000000001deb012100010000000000001dec012100010000000000001ded012100010000000000001dee012100010000000000001def012100010000000000001df0012100010000000000001df1012100010000000000001df2012100010000000000001df3012100010000000000001df4012100010000000000001df5012100010000000000001df6012100010000000000001df7012100010000000000001df8012100010000000000001df9012100010000000000001dfa012100010000000000001dfb012100010000000000001dfc012100010000000000001dfd012100010000000000001dfe012100010000000000001dff012100010000000000001e00012100010000000000001e01012100010000000000001e02012100010000000000001e03012100010000000000001e04012100010000000000001e05012100010000000000001e06012100010000000000001e07012100010000000000001e08012100010000000000001e09012100010000000000001e0a012100010000000000001e0b012100010000000000001e0c012100010000000000001e0d012100010000000000001e0e012100010000000000001e0f012100010000000000001e10012100010000000000001e11012100010000000000001e12012100010000000000001e13012100010000000000001e14012100010000000000001e15012100010000000000001e16012100010000000000001e17012100010000000000001e18012100010000000000001e19012100010000000000001e1a012100010000000000001e1b012100010000000000001e1c012100010000000000001e1d012100010000000000001e1e012100010000000000001e1f012100010000000000001e20012100010000000000001e21012100010000000000001e22012100010000000000001e23012100010000000000001e24012100010000000000001e25012100010000000000001e26012100010000000000001e27012100010000000000001e28012100010000000000001e29012100010000000000001e2a012100010000000000001e2b012100010000000000001e2c012100010000000000001e2d012100010000000000001e2e012100010000000000001e2f012100010000000000001e30012100010000000000001e31012100010000000000001e32012100010000000000001e33012100010000000000001e34012100010000000000001e35012100010000000000001e36012100010000000000001e37012100010000000000001e38012100010000000000001e39012100010000000000001e3a012100010000000000001e3b012100010000000000001e3c012100010000000000001e3d012100010000000000001e3e012100010000000000001e3f012100010000000000001e40012100010000000000001e41012100010000000000001e42012100010000000000001e43012100010000000000001e44012100010000000000001e45012100010000000000001e46012100010000000000001e47012100010000000000001e48012100010000000000001e49012100010000000000001e4a012100010000000000001e4b012100010000000000001e4c012100010000000000001e4d012100010000000000001e4e012100010000000000001e4f012100010000000000001e50012100010000000000001e51012100010000000000001e52012100010000000000001e53012100010000000000001e54012100010000000000001e55012100010000000000001e56012100010000000000001e57012100010000000000001e58012100010000000000001e59012100010000000000001e5a012100010000000000001e5b012100010000000000001e5c012100010000000000001e5d012100010000000000001e5e012100010000000000001e5f012100010000000000001e60012100010000000000001e61012100010000000000001e62012100010000000000001e63012100010000000000001e64012100010000000000001e65012100010000000000001e66012100010000000000001e67012100010000000000001e68012100010000000000001e69012100010000000000001e6a012100010000000000001e6b012100010000000000001e6c012100010000000000001e6d012100010000000000001e6e012100010000000000001e6f012100010000000000001e70012100010000000000001e71012100010000000000001e72012100010000000000001e73012100010000000000001e74012100010000000000001e75012100010000000000001e76012100010000000000001e77012100010000000000001e78012100010000000000001e79012100010000000000001e7a012100010000000000001e7b012100010000000000001e7c012100010000000000001e7d012100010000000000001e7e012100010000000000001e7f012100010000000000001e80012100010000000000001e81012100010000000000001e82012100010000000000001e83012100010000000000001e84012100010000000000001e85012100010000000000001e86012100010000000000001e87012100010000000000001e88012100010000000000001e89012100010000000000001e8a012100010000000000001e8b012100010000000000001e8c012100010000000000001e8d012100010000000000001e8e012100010000000000001e8f012100010000000000001e90012100010000000000001e91012100010000000000001e92012100010000000000001e93012100010000000000001e94012100010000000000001e95012100010000000000001e96012100010000000000001e97012100010000000000001e98012100010000000000001e99012100010000000000001e9a012100010000000000001e9b012100010000000000001e9c012100010000000000001e9d012100010000000000001e9e012100010000000000001e9f012100010000000000001ea0012100010000000000001ea1012100010000000000001ea2012100010000000000001ea3012100010000000000001ea4012100010000000000001ea5012100010000000000001ea6012100010000000000001ea7012100010000000000001ea8012100010000000000001ea9012100010000000000001eaa012100010000000000001eab012100010000000000001eac012100010000000000001ead012100010000000000001eae012100010000000000001eaf012100010000000000001eb0012100010000000000001eb1012100010000000000001eb2012100010000000000001eb3012100010000000000001eb4012100010000000000001eb5012100010000000000001eb6012100010000000000001eb7012100010000000000001eb8012100010000000000001eb9012100010000000000001eba012100010000000000001ebb012100010000000000001ebc012100010000000000001ebd012100010000000000001ebe012100010000000000001ebf012100010000000000001ec0012100010000000000001ec1012100010000000000001ec2012100010000000000001ec3012100010000000000001ec4012100010000000000001ec5012100010000000000001ec6012100010000000000001ec7012100010000000000001ec8012100010000000000001ec9012100010000000000001eca012100010000000000001ecb012100010000000000001ecc012100010000000000001ecd012100010000000000001ece012100010000000000001ecf012100010000000000001ed0012100010000000000001ed1012100010000000000001ed2012100010000000000001ed3012100010000000000001ed4012100010000000000001ed5012100010000000000001ed6012100010000000000001ed7012100010000000000001ed8012100010000000000001ed9012100010000000000001eda012100010000000000001edb012100010000000000001edc012100010000000000001edd012100010000000000001ede012100010000000000001edf012100010000000000001ee0012100010000000000001ee1012100010000000000001ee2012100010000000000001ee3012100010000000000001ee4012100010000000000001ee5012100010000000000001ee6012100010000000000001ee7012100010000000000001ee8012100010000000000001ee9012100010000000000001eea012100010000000000001eeb012100010000000000001eec012100010000000000001eed012100010000000000001eee012100010000000000001eef012100010000000000001ef0012100010000000000001ef1012100010000000000001ef2012100010000000000001ef3012100010000000000001ef4012100010000000000001ef5012100010000000000001ef6012100010000000000001ef7012100010000000000001ef8012100010000000000001ef9012100010000000000001efa012100010000000000001efb012100010000000000001efc012100010000000000001efd012100010000000000001efe012100010000000000001eff012100010000000000001f00012100010000000000001f01012100010000000000001f02012100010000000000001f03012100010000000000001f04012100010000000000001f05012100010000000000001f06012100010000000000001f07012100010000000000001f08012100010000000000001f09012100010000000000001f0a012100010000000000001f0b012100010000000000001f0c012100010000000000001f0d012100010000000000001f0e012100010000000000001f0f012100010000000000001f10012100010000000000001f11012100010000000000001f12012100010000000000001f13012100010000000000001f14012100010000000000001f15012100010000000000001f16012100010000000000001f17012100010000000000001f18012100010000000000001f19012100010000000000001f1a012100010000000000001f1b012100010000000000001f1c012100010000000000001f1d012100010000000000001f1e012100010000000000001f1f012100010000000000001f20012100010000000000001f21012100010000000000001f22012100010000000000001f23012100010000000000001f24012100010000000000001f25012100010000000000001f26012100010000000000001f27012100010000000000001f28012100010000000000001f29012100010000000000001f2a012100010000000000001f2b012100010000000000001f2c012100010000000000001f2d012100010000000000001f2e012100010000000000001f2f012100010000000000001f30012100010000000000001f31012100010000000000001f32012100010000000000001f33012100010000000000001f34012100010000000000001f35012100010000000000001f36012100010000000000001f37012100010000000000001f38012100010000000000001f39012100010000000000001f3a012100010000000000001f3b012100010000000000001f3c012100010000000000001f3d012100010000000000001f3e012100010000000000001f3f012100010000000000001f40012100010000000000001f41012100010000000000001f42012100010000000000001f43012100010000000000001f44012100010000000000001f45012100010000000000001f46012100010000000000001f47012100010000000000001f48012100010000000000001f49012100010000000000001f4a012100010000000000001f4b012100010000000000001f4c012100010000000000001f4d012100010000000000001f4e012100010000000000001f4f012100010000000000001f50012100010000000000001f51012100010000000000001f52012100010000000000001f53012100010000000000001f54012100010000000000001f55012100010000000000001f56012100010000000000001f57012100010000000000001f58012100010000000000001f59012100010000000000001f5a012100010000000000001f5b012100010000000000001f5c012100010000000000001f5d012100010000000000001f5e012100010000000000001f5f012100010000000000001f60012100010000000000001f61012100010000000000001f62012100010000000000001f63012100010000000000001f64012100010000000000001f65012100010000000000001f66012100010000000000001f67012100010000000000001f68012100010000000000001f69012100010000000000001f6a012100010000000000001f6b012100010000000000001f6c012100010000000000001f6d012100010000000000001f6e012100010000000000001f6f012100010000000000001f70012100010000000000001f71012100010000000000001f72012100010000000000001f73012100010000000000001f74012100010000000000001f75012100010000000000001f76012100010000000000001f77012100010000000000001f78012100010000000000001f79012100010000000000001f7a012100010000000000001f7b012100010000000000001f7c012100010000000000001f7d012100010000000000001f7e012100010000000000001f7f012100010000000000001f80012100010000000000001f81012100010000000000001f82012100010000000000001f83012100010000000000001f84012100010000000000001f85012100010000000000001f86012100010000000000001f87012100010000000000001f88012100010000000000001f89012100010000000000001f8a012100010000000000001f8b012100010000000000001f8c012100010000000000001f8d012100010000000000001f8e012100010000000000001f8f012100010000000000001f90012100010000000000001f91012100010000000000001f92012100010000000000001f93012100010000000000001f94012100010000000000001f95012100010000000000001f96012100010000000000001f97012100010000000000001f98012100010000000000001f99012100010000000000001f9a012100010000000000001f9b012100010000000000001f9c012100010000000000001f9d012100010000000000001f9e012100010000000000001f9f012100010000000000001fa0012100010000000000001fa1012100010000000000001fa2012100010000000000001fa3012100010000000000001fa4012100010000000000001fa5012100010000000000001fa6012100010000000000001fa7012100010000000000001fa8012100010000000000001fa9012100010000000000001faa012100010000000000001fab012100010000000000001fac012100010000000000001fad012100010000000000001fae012100010000000000001faf012100010000000000001fb0012100010000000000001fb1012100010000000000001fb2012100010000000000001fb3012100010000000000001fb4012100010000000000001fb5012100010000000000001fb6012100010000000000001fb7012100010000000000001fb8012100010000000000001fb9012100010000000000001fba012100010000000000001fbb012100010000000000001fbc012100010000000000001fbd012100010000000000001fbe012100010000000000001fbf012100010000000000001fc0012100010000000000001fc1012100010000000000001fc2012100010000000000001fc3012100010000000000001fc4012100010000000000001fc5012100010000000000001fc6012100010000000000001fc7012100010000000000001fc8012100010000000000001fc9012100010000000000001fca012100010000000000001fcb012100010000000000001fcc012100010000000000001fcd012100010000000000001fce012100010000000000001fcf012100010000000000001fd0012100010000000000001fd1012100010000000000001fd2012100010000000000001fd3012100010000000000001fd4012100010000000000001fd5012100010000000000001fd6012100010000000000001fd7012100010000000000001fd8012100010000000000001fd9012100010000000000001fda012100010000000000001fdb012100010000000000001fdc012100010000000000001fdd012100010000000000001fde012100010000000000001fdf012100010000000000001fe0012100010000000000001fe1012100010000000000001fe2012100010000000000001fe3012100010000000000001fe4012100010000000000001fe5012100010000000000001fe6012100010000000000001fe7012100010000000000001fe8012100010000000000001fe9012100010000000000001fea012100010000000000001feb012100010000000000001fec012100010000000000001fed012100010000000000001fee012100010000000000001fef012100010000000000001ff0012100010000000000001ff1012100010000000000001ff2012100010000000000001ff3012100010000000000001ff4012100010000000000001ff5012100010000000000001ff6012100010000000000001ff7012100010000000000001ff8012100010000000000001ff9012100010000000000001ffa012100010000000000001ffb012100010000000000001ffc012100010000000000001ffd012100010000000000001ffe012100010000000000001fff01210001000000000000200001210001000000000000200101210001000000000000200201210001000000000000200301210001000000000000200401210001000000000000200501210001000000000000200601210001000000000000200701210001000000000000200801210001000000000000200901210001000000000000200a01210001000000000000200b01210001000000000000200c01210001000000000000200d01210001000000000000200e01210001000000000000200f01210001000000000000201001210001000000000000201101210001000000000000201201210001000000000000201301210001000000000000201401210001000000000000201501210001000000000000201601210001000000000000201701210001000000000000201801210001000000000000201901210001000000000000201a01210001000000000000201b01210001000000000000201c01210001000000000000201d01210001000000000000201e01210001000000000000201f01210001000000000000202001210001000000000000202101210001000000000000202201210001000000000000202301210001000000000000202401210001000000000000202501210001000000000000202601210001000000000000202701210001000000000000202801210001000000000000202901210001000000000000202a01210001000000000000202b01210001000000000000202c01210001000000000000202d01210001000000000000202e01210001000000000000202f01210001000000000000203001210001000000000000203101210001000000000000203201210001000000000000203301210001000000000000203401210001000000000000203501210001000000000000203601210001000000000000203701210001000000000000203801210001000000000000203901210001000000000000203a01210001000000000000203b01210001000000000000203c01210001000000000000203d01210001000000000000203e01210001000000000000203f01210001000000000000204001210001000000000000204101210001000000000000204201210001000000000000204301210001000000000000204401210001000000000000204501210001000000000000204601210001000000000000204701210001000000000000204801210001000000000000204901210001000000000000204a01210001000000000000204b01210001000000000000204c01210001000000000000204d01210001000000000000204e01210001000000000000204f01210001000000000000205001210001000000000000205101210001000000000000205201210001000000000000205301210001000000000000205401210001000000000000205501210001000000000000205601210001000000000000205701210001000000000000205801210001000000000000205901210001000000000000205a01210001000000000000205b01210001000000000000205c01210001000000000000205d01210001000000000000205e01210001000000000000205f01210001000000000000206001210001000000000000206101210001000000000000206201210001000000000000206301210001000000000000206401210001000000000000206501210001000000000000206601210001000000000000206701210001000000000000206801210001000000000000206901210001000000000000206a01210001000000000000206b01210001000000000000206c01210001000000000000206d01210001000000000000206e01210001000000000000206f01210001000000000000207001210001000000000000207101210001000000000000207201210001000000000000207301210001000000000000207401210001000000000000207501210001000000000000207601210001000000000000207701210001000000000000207801210001000000000000207901210001000000000000207a01210001000000000000207b01210001000000000000207c01210001000000000000207d01210001000000000000207e01210001000000000000207f01210001000000000000208001210001000000000000208101210001000000000000208201210001000000000000208301210001000000000000208401210001000000000000208501210001000000000000208601210001000000000000208701210001000000000000208801210001000000000000208901210001000000000000208a01210001000000000000208b01210001000000000000208c01210001000000000000208d01210001000000000000208e01210001000000000000208f01210001000000000000209001210001000000000000209101210001000000000000209201210001000000000000209301210001000000000000209401210001000000000000209501210001000000000000209601210001000000000000209701210001000000000000209801210001000000000000209901210001000000000000209a01210001000000000000209b01210001000000000000209c01210001000000000000209d01210001000000000000209e01210001000000000000209f0121000100000000000020a00121000100000000000020a10121000100000000000020a20121000100000000000020a30121000100000000000020a40121000100000000000020a50121000100000000000020a60121000100000000000020a70121000100000000000020a80121000100000000000020a90121000100000000000020aa0121000100000000000020ab0121000100000000000020ac0121000100000000000020ad0121000100000000000020ae0121000100000000000020af0121000100000000000020b00121000100000000000020b10121000100000000000020b20121000100000000000020b30121000100000000000020b40121000100000000000020b50121000100000000000020b60121000100000000000020b70121000100000000000020b80121000100000000000020b90121000100000000000020ba0121000100000000000020bb0121000100000000000020bc0121000100000000000020bd0121000100000000000020be0121000100000000000020bf0121000100000000000020c00121000100000000000020c10121000100000000000020c20121000100000000000020c30121000100000000000020c40121000100000000000020c50121000100000000000020c60121000100000000000020c70121000100000000000020c80121000100000000000020c90121000100000000000020ca0121000100000000000020cb0121000100000000000020cc0121000100000000000020cd0121000100000000000020ce0121000100000000000020cf0121000100000000000020d00121000100000000000020d10121000100000000000020d20121000100000000000020d30121000100000000000020d40121000100000000000020d50121000100000000000020d60121000100000000000020d70121000100000000000020d80121000100000000000020d90121000100000000000020da0121000100000000000020db0121000100000000000020dc0121000100000000000020dd0121000100000000000020de0121000100000000000020df0121000100000000000020e00121000100000000000020e10121000100000000000020e20121000100000000000020e30121000100000000000020e40121000100000000000020e50121000100000000000020e60121000100000000000020e70121000100000000000020e80121000100000000000020e90121000100000000000020ea0121000100000000000020eb0121000100000000000020ec0121000100000000000020ed0121000100000000000020ee0121000100000000000020ef0121000100000000000020f00121000100000000000020f10121000100000000000020f20121000100000000000020f30121000100000000000020f40121000100000000000020f50121000100000000000020f60121000100000000000020f70121000100000000000020f80121000100000000000020f90121000100000000000020fa0121000100000000000020fb0121000100000000000020fc0121000100000000000020fd0121000100000000000020fe0121000100000000000020ff01210001000000000000210001210001000000000000210101210001000000000000210201210001000000000000210301210001000000000000210401210001000000000000210501210001000000000000210601210001000000000000210701210001000000000000210801210001000000000000210901210001000000000000210a01210001000000000000210b01210001000000000000210c01210001000000000000210d01210001000000000000210e01210001000000000000210f01210001000000000000211001210001000000000000211101210001000000000000211201210001000000000000211301210001000000000000211401210001000000000000211501210001000000000000211601210001000000000000211701210001000000000000211801210001000000000000211901210001000000000000211a01210001000000000000211b01210001000000000000211c01210001000000000000211d01210001000000000000211e01210001000000000000211f01210001000000000000212001210001000000000000212101210001000000000000212201210001000000000000212301210001000000000000212401210001000000000000212501210001000000000000212601210001000000000000212701210001000000000000212801210001000000000000212901210001000000000000212a01210001000000000000212b01210001000000000000212c01210001000000000000212d01210001000000000000212e01210001000000000000212f01210001000000000000213001210001000000000000213101210001000000000000213201210001000000000000213301210001000000000000213401210001000000000000213501210001000000000000213601210001000000000000213701210001000000000000213801210001000000000000213901210001000000000000213a01210001000000000000213b01210001000000000000213c01210001000000000000213d01210001000000000000213e01210001000000000000213f01210001000000000000214001210001000000000000214101210001000000000000214201210001000000000000214301210001000000000000214401210001000000000000214501210001000000000000214601210001000000000000214701210001000000000000214801210001000000000000214901210001000000000000214a01210001000000000000214b01210001000000000000214c01210001000000000000214d01210001000000000000214e01210001000000000000214f01210001000000000000215001210001000000000000215101210001000000000000215201210001000000000000215301210001000000000000215401210001000000000000215501210001000000000000215601210001000000000000215701210001000000000000215801210001000000000000215901210001000000000000215a01210001000000000000215b01210001000000000000215c01210001000000000000215d01210001000000000000215e01210001000000000000215f01210001000000000000216001210001000000000000216101210001000000000000216201210001000000000000216301210001000000000000216401210001000000000000216501210001000000000000216601210001000000000000216701210001000000000000216801210001000000000000216901210001000000000000216a01210001000000000000216b01210001000000000000216c01210001000000000000216d01210001000000000000216e01210001000000000000216f01210001000000000000217001210001000000000000217101210001000000000000217201210001000000000000217301210001000000000000217401210001000000000000217501210001000000000000217601210001000000000000217701210001000000000000217801210001000000000000217901210001000000000000217a01210001000000000000217b01210001000000000000217c01210001000000000000217d01210001000000000000217e01210001000000000000217f01210001000000000000218001210001000000000000218101210001000000000000218201210001000000000000218301210001000000000000218401210001000000000000218501210001000000000000218601210001000000000000218701210001000000000000218801210001000000000000218901210001000000000000218a01210001000000000000218b01210001000000000000218c01210001000000000000218d01210001000000000000218e01210001000000000000218f01210001000000000000219001210001000000000000219101210001000000000000219201210001000000000000219301210001000000000000219401210001000000000000219501210001000000000000219601210001000000000000219701210001000000000000219801210001000000000000219901210001000000000000219a01210001000000000000219b01210001000000000000219c01210001000000000000219d01210001000000000000219e01210001000000000000219f0121000100000000000021a00121000100000000000021a10121000100000000000021a20121000100000000000021a30121000100000000000021a40121000100000000000021a50121000100000000000021a60121000100000000000021a70121000100000000000021a80121000100000000000021a90121000100000000000021aa0121000100000000000021ab0121000100000000000021ac0121000100000000000021ad0121000100000000000021ae0121000100000000000021af0121000100000000000021b00121000100000000000021b10121000100000000000021b20121000100000000000021b30121000100000000000021b40121000100000000000021b50121000100000000000021b60121000100000000000021b70121000100000000000021b80121000100000000000021b90121000100000000000021ba0121000100000000000021bb0121000100000000000021bc0121000100000000000021bd0121000100000000000021be0121000100000000000021bf0121000100000000000021c00121000100000000000021c10121000100000000000021c20121000100000000000021c30121000100000000000021c40121000100000000000021c50121000100000000000021c60121000100000000000021c70121000100000000000021c80121000100000000000021c90121000100000000000021ca0121000100000000000021cb0121000100000000000021cc0121000100000000000021cd0121000100000000000021ce0121000100000000000021cf0121000100000000000021d00121000100000000000021d10121000100000000000021d20121000100000000000021d30121000100000000000021d40121000100000000000021d50121000100000000000021d60121000100000000000021d70121000100000000000021d80121000100000000000021d90121000100000000000021da0121000100000000000021db0121000100000000000021dc0121000100000000000021dd0121000100000000000021de0121000100000000000021df0121000100000000000021e00121000100000000000021e10121000100000000000021e20121000100000000000021e30121000100000000000021e40121000100000000000021e50121000100000000000021e60121000100000000000021e70121000100000000000021e80121000100000000000021e90121000100000000000021ea0121000100000000000021eb0121000100000000000021ec0121000100000000000021ed0121000100000000000021ee0121000100000000000021ef0121000100000000000021f00121000100000000000021f10121000100000000000021f20121000100000000000021f30121000100000000000021f40121000100000000000021f50121000100000000000021f60121000100000000000021f70121000100000000000021f80121000100000000000021f90121000100000000000021fa0121000100000000000021fb0121000100000000000021fc0121000100000000000021fd0121000100000000000021fe0121000100000000000021ff01210001000000000000220001210001000000000000220101210001000000000000220201210001000000000000220301210001000000000000220401210001000000000000220501210001000000000000220601210001000000000000220701210001000000000000220801210001000000000000220901210001000000000000220a01210001000000000000220b01210001000000000000220c01210001000000000000220d01210001000000000000220e01210001000000000000220f01210001000000000000221001210001000000000000221101210001000000000000221201210001000000000000221301210001000000000000221401210001000000000000221501210001000000000000221601210001000000000000221701210001000000000000221801210001000000000000221901210001000000000000221a01210001000000000000221b01210001000000000000221c01210001000000000000221d01210001000000000000221e01210001000000000000221f01210001000000000000222001210001000000000000222101210001000000000000222201210001000000000000222301210001000000000000222401210001000000000000222501210001000000000000222601210001000000000000222701210001000000000000222801210001000000000000222901210001000000000000222a01210001000000000000222b01210001000000000000222c01210001000000000000222d01210001000000000000222e01210001000000000000222f01210001000000000000223001210001000000000000223101210001000000000000223201210001000000000000223301210001000000000000223401210001000000000000223501210001000000000000223601210001000000000000223701210001000000000000223801210001000000000000223901210001000000000000223a01210001000000000000223b01210001000000000000223c01210001000000000000223d01210001000000000000223e01210001000000000000223f01210001000000000000224001210001000000000000224101210001000000000000224201210001000000000000224301210001000000000000224401210001000000000000224501210001000000000000224601210001000000000000224701210001000000000000224801210001000000000000224901210001000000000000224a01210001000000000000224b01210001000000000000224c01210001000000000000224d01210001000000000000224e01210001000000000000224f01210001000000000000225001210001000000000000225101210001000000000000225201210001000000000000225301210001000000000000225401210001000000000000225501210001000000000000225601210001000000000000225701210001000000000000225801210001000000000000225901210001000000000000225a01210001000000000000225b01210001000000000000225c01210001000000000000225d01210001000000000000225e01210001000000000000225f01210001000000000000226001210001000000000000226101210001000000000000226201210001000000000000226301210001000000000000226401210001000000000000226501210001000000000000226601210001000000000000226701210001000000000000226801210001000000000000226901210001000000000000226a01210001000000000000226b01210001000000000000226c01210001000000000000226d01210001000000000000226e01210001000000000000226f01210001000000000000227001210001000000000000227101210001000000000000227201210001000000000000227301210001000000000000227401210001000000000000227501210001000000000000227601210001000000000000227701210001000000000000227801210001000000000000227901210001000000000000227a01210001000000000000227b01210001000000000000227c01210001000000000000227d01210001000000000000227e01210001000000000000227f01210001000000000000228001210001000000000000228101210001000000000000228201210001000000000000228301210001000000000000228401210001000000000000228501210001000000000000228601210001000000000000228701210001000000000000228801210001000000000000228901210001000000000000228a01210001000000000000228b01210001000000000000228c01210001000000000000228d01210001000000000000228e01210001000000000000228f01210001000000000000229001210001000000000000229101210001000000000000229201210001000000000000229301210001000000000000229401210001000000000000229501210001000000000000229601210001000000000000229701210001000000000000229801210001000000000000229901210001000000000000229a01210001000000000000229b01210001000000000000229c01210001000000000000229d01210001000000000000229e01210001000000000000229f0121000100000000000022a00121000100000000000022a10121000100000000000022a20121000100000000000022a30121000100000000000022a40121000100000000000022a50121000100000000000022a60121000100000000000022a70121000100000000000022a80121000100000000000022a90121000100000000000022aa0121000100000000000022ab0121000100000000000022ac0121000100000000000022ad0121000100000000000022ae0121000100000000000022af0121000100000000000022b00121000100000000000022b10121000100000000000022b20121000100000000000022b30121000100000000000022b40121000100000000000022b50121000100000000000022b60121000100000000000022b70121000100000000000022b80121000100000000000022b90121000100000000000022ba0121000100000000000022bb0121000100000000000022bc0121000100000000000022bd0121000100000000000022be0121000100000000000022bf0121000100000000000022c00121000100000000000022c10121000100000000000022c20121000100000000000022c30121000100000000000022c40121000100000000000022c50121000100000000000022c60121000100000000000022c70121000100000000000022c80121000100000000000022c90121000100000000000022ca0121000100000000000022cb0121000100000000000022cc0121000100000000000022cd0121000100000000000022ce0121000100000000000022cf0121000100000000000022d00121000100000000000022d10121000100000000000022d20121000100000000000022d30121000100000000000022d40121000100000000000022d50121000100000000000022d60121000100000000000022d70121000100000000000022d80121000100000000000022d90121000100000000000022da0121000100000000000022db0121000100000000000022dc0121000100000000000022dd0121000100000000000022de0121000100000000000022df0121000100000000000022e00121000100000000000022e10121000100000000000022e20121000100000000000022e30121000100000000000022e40121000100000000000022e50121000100000000000022e60121000100000000000022e70121000100000000000022e80121000100000000000022e90121000100000000000022ea0121000100000000000022eb0121000100000000000022ec0121000100000000000022ed0121000100000000000022ee0121000100000000000022ef0121000100000000000022f00121000100000000000022f10121000100000000000022f20121000100000000000022f30121000100000000000022f40121000100000000000022f50121000100000000000022f60121000100000000000022f70121000100000000000022f80121000100000000000022f90121000100000000000022fa0121000100000000000022fb0121000100000000000022fc0121000100000000000022fd0121000100000000000022fe0121000100000000000022ff01210001000000000000230001210001000000000000230101210001000000000000230201210001000000000000230301210001000000000000230401210001000000000000230501210001000000000000230601210001000000000000230701210001000000000000230801210001000000000000230901210001000000000000230a01210001000000000000230b01210001000000000000230c01210001000000000000230d01210001000000000000230e01210001000000000000230f01210001000000000000231001210001000000000000231101210001000000000000231201210001000000000000231301210001000000000000231401210001000000000000231501210001000000000000231601210001000000000000231701210001000000000000231801210001000000000000231901210001000000000000231a01210001000000000000231b01210001000000000000231c01210001000000000000231d01210001000000000000231e01210001000000000000231f01210001000000000000232001210001000000000000232101210001000000000000232201210001000000000000232301210001000000000000232401210001000000000000232501210001000000000000232601210001000000000000232701210001000000000000232801210001000000000000232901210001000000000000232a01210001000000000000232b01210001000000000000232c01210001000000000000232d01210001000000000000232e01210001000000000000232f01210001000000000000233001210001000000000000233101210001000000000000233201210001000000000000233301210001000000000000233401210001000000000000233501210001000000000000233601210001000000000000233701210001000000000000233801210001000000000000233901210001000000000000233a01210001000000000000233b01210001000000000000233c01210001000000000000233d01210001000000000000233e01210001000000000000233f01210001000000000000234001210001000000000000234101210001000000000000234201210001000000000000234301210001000000000000234401210001000000000000234501210001000000000000234601210001000000000000234701210001000000000000234801210001000000000000234901210001000000000000234a01210001000000000000234b01210001000000000000234c01210001000000000000234d01210001000000000000234e01210001000000000000234f01210001000000000000235001210001000000000000235101210001000000000000235201210001000000000000235301210001000000000000235401210001000000000000235501210001000000000000235601210001000000000000235701210001000000000000235801210001000000000000235901210001000000000000235a01210001000000000000235b01210001000000000000235c01210001000000000000235d01210001000000000000235e01210001000000000000235f01210001000000000000236001210001000000000000236101210001000000000000236201210001000000000000236301210001000000000000236401210001000000000000236501210001000000000000236601210001000000000000236701210001000000000000236801210001000000000000236901210001000000000000236a01210001000000000000236b01210001000000000000236c01210001000000000000236d01210001000000000000236e01210001000000000000236f01210001000000000000237001210001000000000000237101210001000000000000237201210001000000000000237301210001000000000000237401210001000000000000237501210001000000000000237601210001000000000000237701210001000000000000237801210001000000000000237901210001000000000000237a01210001000000000000237b01210001000000000000237c01210001000000000000237d01210001000000000000237e01210001000000000000237f01210001000000000000238001210001000000000000238101210001000000000000238201210001000000000000238301210001000000000000238401210001000000000000238501210001000000000000238601210001000000000000238701210001000000000000238801210001000000000000238901210001000000000000238a01210001000000000000238b01210001000000000000238c01210001000000000000238d01210001000000000000238e01210001000000000000238f01210001000000000000239001210001000000000000239101210001000000000000239201210001000000000000239301210001000000000000239401210001000000000000239501210001000000000000239601210001000000000000239701210001000000000000239801210001000000000000239901210001000000000000239a01210001000000000000239b01210001000000000000239c01210001000000000000239d01210001000000000000239e01210001000000000000239f0121000100000000000023a00121000100000000000023a10121000100000000000023a20121000100000000000023a30121000100000000000023a40121000100000000000023a50121000100000000000023a60121000100000000000023a70121000100000000000023a80121000100000000000023a90121000100000000000023aa0121000100000000000023ab0121000100000000000023ac0121000100000000000023ad0121000100000000000023ae0121000100000000000023af0121000100000000000023b00121000100000000000023b10121000100000000000023b20121000100000000000023b30121000100000000000023b40121000100000000000023b50121000100000000000023b60121000100000000000023b70121000100000000000023b80121000100000000000023b90121000100000000000023ba0121000100000000000023bb0121000100000000000023bc0121000100000000000023bd0121000100000000000023be0121000100000000000023bf0121000100000000000023c00121000100000000000023c10121000100000000000023c20121000100000000000023c30121000100000000000023c40121000100000000000023c50121000100000000000023c60121000100000000000023c70121000100000000000023c80121000100000000000023c90121000100000000000023ca0121000100000000000023cb0121000100000000000023cc0121000100000000000023cd0121000100000000000023ce0121000100000000000023cf0121000100000000000023d00121000100000000000023d10121000100000000000023d20121000100000000000023d30121000100000000000023d40121000100000000000023d50121000100000000000023d60121000100000000000023d70121000100000000000023d80121000100000000000023d90121000100000000000023da0121000100000000000023db0121000100000000000023dc0121000100000000000023dd0121000100000000000023de0121000100000000000023df0121000100000000000023e00121000100000000000023e10121000100000000000023e20121000100000000000023e30121000100000000000023e40121000100000000000023e50121000100000000000023e60121000100000000000023e70121000100000000000023e80121000100000000000023e90121000100000000000023ea0121000100000000000023eb0121000100000000000023ec0121000100000000000023ed0121000100000000000023ee0121000100000000000023ef0121000100000000000023f00121000100000000000023f10121000100000000000023f20121000100000000000023f30121000100000000000023f40121000100000000000023f50121000100000000000023f60121000100000000000023f70121000100000000000023f80121000100000000000023f90121000100000000000023fa0121000100000000000023fb0121000100000000000023fc0121000100000000000023fd0121000100000000000023fe0121000100000000000023ff01210001000000000000240001210001000000000000240101210001000000000000240201210001000000000000240301210001000000000000240401210001000000000000240501210001000000000000240601210001000000000000240701210001000000000000240801210001000000000000240901210001000000000000240a01210001000000000000240b01210001000000000000240c01210001000000000000240d01210001000000000000240e01210001000000000000240f01210001000000000000241001210001000000000000241101210001000000000000241201210001000000000000241301210001000000000000241401210001000000000000241501210001000000000000241601210001000000000000241701210001000000000000241801210001000000000000241901210001000000000000241a01210001000000000000241b01210001000000000000241c01210001000000000000241d01210001000000000000241e01210001000000000000241f01210001000000000000242001210001000000000000242101210001000000000000242201210001000000000000242301210001000000000000242401210001000000000000242501210001000000000000242601210001000000000000242701210001000000000000242801210001000000000000242901210001000000000000242a01210001000000000000242b01210001000000000000242c01210001000000000000242d01210001000000000000242e01210001000000000000242f01210001000000000000243001210001000000000000243101210001000000000000243201210001000000000000243301210001000000000000243401210001000000000000243501210001000000000000243601210001000000000000243701210001000000000000243801210001000000000000243901210001000000000000243a01210001000000000000243b01210001000000000000243c01210001000000000000243d01210001000000000000243e01210001000000000000243f01210001000000000000244001210001000000000000244101210001000000000000244201210001000000000000244301210001000000000000244401210001000000000000244501210001000000000000244601210001000000000000244701210001000000000000244801210001000000000000244901210001000000000000244a01210001000000000000244b01210001000000000000244c01210001000000000000244d01210001000000000000244e01210001000000000000244f01210001000000000000245001210001000000000000245101210001000000000000245201210001000000000000245301210001000000000000245401210001000000000000245501210001000000000000245601210001000000000000245701210001000000000000245801210001000000000000245901210001000000000000245a01210001000000000000245b01210001000000000000245c01210001000000000000245d01210001000000000000245e01210001000000000000245f01210001000000000000246001210001000000000000246101210001000000000000246201210001000000000000246301210001000000000000246401210001000000000000246501210001000000000000246601210001000000000000246701210001000000000000246801210001000000000000246901210001000000000000246a01210001000000000000246b01210001000000000000246c01210001000000000000246d01210001000000000000246e01210001000000000000246f01210001000000000000247001210001000000000000247101210001000000000000247201210001000000000000247301210001000000000000247401210001000000000000247501210001000000000000247601210001000000000000247701210001000000000000247801210001000000000000247901210001000000000000247a01210001000000000000247b01210001000000000000247c01210001000000000000247d01210001000000000000247e01210001000000000000247f01210001000000000000248001210001000000000000248101210001000000000000248201210001000000000000248301210001000000000000248401210001000000000000248501210001000000000000248601210001000000000000248701210001000000000000248801210001000000000000248901210001000000000000248a01210001000000000000248b01210001000000000000248c01210001000000000000248d01210001000000000000248e01210001000000000000248f01210001000000000000249001210001000000000000249101210001000000000000249201210001000000000000249301210001000000000000249401210001000000000000249501210001000000000000249601210001000000000000249701210001000000000000249801210001000000000000249901210001000000000000249a01210001000000000000249b01210001000000000000249c01210001000000000000249d01210001000000000000249e01210001000000000000249f0121000100000000000024a00121000100000000000024a10121000100000000000024a20121000100000000000024a30121000100000000000024a40121000100000000000024a50121000100000000000024a60121000100000000000024a70121000100000000000024a80121000100000000000024a90121000100000000000024aa0121000100000000000024ab0121000100000000000024ac0121000100000000000024ad0121000100000000000024ae0121000100000000000024af0121000100000000000024b00121000100000000000024b10121000100000000000024b20121000100000000000024b30121000100000000000024b40121000100000000000024b50121000100000000000024b60121000100000000000024b70121000100000000000024b80121000100000000000024b90121000100000000000024ba0121000100000000000024bb0121000100000000000024bc0121000100000000000024bd0121000100000000000024be0121000100000000000024bf0121000100000000000024c00121000100000000000024c10121000100000000000024c20121000100000000000024c30121000100000000000024c40121000100000000000024c50121000100000000000024c60121000100000000000024c70121000100000000000024c80121000100000000000024c90121000100000000000024ca0121000100000000000024cb0121000100000000000024cc0121000100000000000024cd0121000100000000000024ce0121000100000000000024cf0121000100000000000024d00121000100000000000024d10121000100000000000024d20121000100000000000024d30121000100000000000024d40121000100000000000024d50121000100000000000024d60121000100000000000024d70121000100000000000024d80121000100000000000024d90121000100000000000024da0121000100000000000024db0121000100000000000024dc0121000100000000000024dd0121000100000000000024de0121000100000000000024df0121000100000000000024e00121000100000000000024e10121000100000000000024e20121000100000000000024e30121000100000000000024e40121000100000000000024e50121000100000000000024e60121000100000000000024e70121000100000000000024e80121000100000000000024e90121000100000000000024ea0121000100000000000024eb0121000100000000000024ec0121000100000000000024ed0121000100000000000024ee0121000100000000000024ef0121000100000000000024f00121000100000000000024f10121000100000000000024f20121000100000000000024f30121000100000000000024f40121000100000000000024f50121000100000000000024f60121000100000000000024f70121000100000000000024f80121000100000000000024f90121000100000000000024fa0121000100000000000024fb0121000100000000000024fc0121000100000000000024fd0121000100000000000024fe0121000100000000000024ff01210001000000000000250001210001000000000000250101210001000000000000250201210001000000000000250301210001000000000000250401210001000000000000250501210001000000000000250601210001000000000000250701210001000000000000250801210001000000000000250901210001000000000000250a01210001000000000000250b01210001000000000000250c01210001000000000000250d01210001000000000000250e01210001000000000000250f01210001000000000000251001210001000000000000251101210001000000000000251201210001000000000000251301210001000000000000251401210001000000000000251501210001000000000000251601210001000000000000251701210001000000000000251801210001000000000000251901210001000000000000251a01210001000000000000251b01210001000000000000251c01210001000000000000251d01210001000000000000251e01210001000000000000251f01210001000000000000252001210001000000000000252101210001000000000000252201210001000000000000252301210001000000000000252401210001000000000000252501210001000000000000252601210001000000000000252701210001000000000000252801210001000000000000252901210001000000000000252a01210001000000000000252b01210001000000000000252c01210001000000000000252d01210001000000000000252e01210001000000000000252f01210001000000000000253001210001000000000000253101210001000000000000253201210001000000000000253301210001000000000000253401210001000000000000253501210001000000000000253601210001000000000000253701210001000000000000253801210001000000000000253901210001000000000000253a01210001000000000000253b01210001000000000000253c01210001000000000000253d01210001000000000000253e01210001000000000000253f01210001000000000000254001210001000000000000254101210001000000000000254201210001000000000000254301210001000000000000254401210001000000000000254501210001000000000000254601210001000000000000254701210001000000000000254801210001000000000000254901210001000000000000254a01210001000000000000254b01210001000000000000254c01210001000000000000254d01210001000000000000254e01210001000000000000254f01210001000000000000255001210001000000000000255101210001000000000000255201210001000000000000255301210001000000000000255401210001000000000000255501210001000000000000255601210001000000000000255701210001000000000000255801210001000000000000255901210001000000000000255a01210001000000000000255b01210001000000000000255c01210001000000000000255d01210001000000000000255e01210001000000000000255f01210001000000000000256001210001000000000000256101210001000000000000256201210001000000000000256301210001000000000000256401210001000000000000256501210001000000000000256601210001000000000000256701210001000000000000256801210001000000000000256901210001000000000000256a01210001000000000000256b01210001000000000000256c01210001000000000000256d01210001000000000000256e01210001000000000000256f01210001000000000000257001210001000000000000257101210001000000000000257201210001000000000000257301210001000000000000257401210001000000000000257501210001000000000000257601210001000000000000257701210001000000000000257801210001000000000000257901210001000000000000257a01210001000000000000257b01210001000000000000257c01210001000000000000257d01210001000000000000257e01210001000000000000257f01210001000000000000258001210001000000000000258101210001000000000000258201210001000000000000258301210001000000000000258401210001000000000000258501210001000000000000258601210001000000000000258701210001000000000000258801210001000000000000258901210001000000000000258a01210001000000000000258b01210001000000000000258c01210001000000000000258d01210001000000000000258e01210001000000000000258f01210001000000000000259001210001000000000000259101210001000000000000259201210001000000000000259301210001000000000000259401210001000000000000259501210001000000000000259601210001000000000000259701210001000000000000259801210001000000000000259901210001000000000000259a01210001000000000000259b01210001000000000000259c01210001000000000000259d01210001000000000000259e01210001000000000000259f0121000100000000000025a00121000100000000000025a10121000100000000000025a20121000100000000000025a30121000100000000000025a40121000100000000000025a50121000100000000000025a60121000100000000000025a70121000100000000000025a80121000100000000000025a90121000100000000000025aa0121000100000000000025ab0121000100000000000025ac0121000100000000000025ad0121000100000000000025ae0121000100000000000025af0121000100000000000025b00121000100000000000025b10121000100000000000025b20121000100000000000025b30121000100000000000025b40121000100000000000025b50121000100000000000025b60121000100000000000025b70121000100000000000025b80121000100000000000025b90121000100000000000025ba0121000100000000000025bb0121000100000000000025bc0121000100000000000025bd0121000100000000000025be0121000100000000000025bf0121000100000000000025c00121000100000000000025c10121000100000000000025c20121000100000000000025c30121000100000000000025c40121000100000000000025c50121000100000000000025c60121000100000000000025c70121000100000000000025c80121000100000000000025c90121000100000000000025ca0121000100000000000025cb0121000100000000000025cc0121000100000000000025cd0121000100000000000025ce0121000100000000000025cf0121000100000000000025d00121000100000000000025d10121000100000000000025d20121000100000000000025d30121000100000000000025d40121000100000000000025d50121000100000000000025d60121000100000000000025d70121000100000000000025d80121000100000000000025d90121000100000000000025da0121000100000000000025db0121000100000000000025dc0121000100000000000025dd0121000100000000000025de0121000100000000000025df0121000100000000000025e00121000100000000000025e10121000100000000000025e20121000100000000000025e30121000100000000000025e40121000100000000000025e50121000100000000000025e60121000100000000000025e70121000100000000000025e80121000100000000000025e90121000100000000000025ea0121000100000000000025eb0121000100000000000025ec0121000100000000000025ed0121000100000000000025ee0121000100000000000025ef0121000100000000000025f00121000100000000000025f10121000100000000000025f20121000100000000000025f30121000100000000000025f40121000100000000000025f50121000100000000000025f60121000100000000000025f70121000100000000000025f80121000100000000000025f90121000100000000000025fa0121000100000000000025fb0121000100000000000025fc0121000100000000000025fd0121000100000000000025fe0121000100000000000025ff01210001000000000000260001210001000000000000260101210001000000000000260201210001000000000000260301210001000000000000260401210001000000000000260501210001000000000000260601210001000000000000260701210001000000000000260801210001000000000000260901210001000000000000260a01210001000000000000260b01210001000000000000260c01210001000000000000260d01210001000000000000260e01210001000000000000260f01210001000000000000261001210001000000000000261101210001000000000000261201210001000000000000261301210001000000000000261401210001000000000000261501210001000000000000261601210001000000000000261701210001000000000000261801210001000000000000261901210001000000000000261a01210001000000000000261b01210001000000000000261c01210001000000000000261d01210001000000000000261e01210001000000000000261f01210001000000000000262001210001000000000000262101210001000000000000262201210001000000000000262301210001000000000000262401210001000000000000262501210001000000000000262601210001000000000000262701210001000000000000262801210001000000000000262901210001000000000000262a01210001000000000000262b01210001000000000000262c01210001000000000000262d01210001000000000000262e01210001000000000000262f01210001000000000000263001210001000000000000263101210001000000000000263201210001000000000000263301210001000000000000263401210001000000000000263501210001000000000000263601210001000000000000263701210001000000000000263801210001000000000000263901210001000000000000263a01210001000000000000263b01210001000000000000263c01210001000000000000263d01210001000000000000263e01210001000000000000263f01210001000000000000264001210001000000000000264101210001000000000000264201210001000000000000264301210001000000000000264401210001000000000000264501210001000000000000264601210001000000000000264701210001000000000000264801210001000000000000264901210001000000000000264a01210001000000000000264b01210001000000000000264c01210001000000000000264d01210001000000000000264e01210001000000000000264f01210001000000000000265001210001000000000000265101210001000000000000265201210001000000000000265301210001000000000000265401210001000000000000265501210001000000000000265601210001000000000000265701210001000000000000265801210001000000000000265901210001000000000000265a01210001000000000000265b01210001000000000000265c01210001000000000000265d01210001000000000000265e01210001000000000000265f01210001000000000000266001210001000000000000266101210001000000000000266201210001000000000000266301210001000000000000266401210001000000000000266501210001000000000000266601210001000000000000266701210001000000000000266801210001000000000000266901210001000000000000266a01210001000000000000266b01210001000000000000266c01210001000000000000266d01210001000000000000266e01210001000000000000266f01210001000000000000267001210001000000000000267101210001000000000000267201210001000000000000267301210001000000000000267401210001000000000000267501210001000000000000267601210001000000000000267701210001000000000000267801210001000000000000267901210001000000000000267a01210001000000000000267b01210001000000000000267c01210001000000000000267d01210001000000000000267e01210001000000000000267f01210001000000000000268001210001000000000000268101210001000000000000268201210001000000000000268301210001000000000000268401210001000000000000268501210001000000000000268601210001000000000000268701210001000000000000268801210001000000000000268901210001000000000000268a01210001000000000000268b01210001000000000000268c01210001000000000000268d01210001000000000000268e01210001000000000000268f01210001000000000000269001210001000000000000269101210001000000000000269201210001000000000000269301210001000000000000269401210001000000000000269501210001000000000000269601210001000000000000269701210001000000000000269801210001000000000000269901210001000000000000269a01210001000000000000269b01210001000000000000269c01210001000000000000269d01210001000000000000269e01210001000000000000269f0121000100000000000026a00121000100000000000026a10121000100000000000026a20121000100000000000026a30121000100000000000026a40121000100000000000026a50121000100000000000026a60121000100000000000026a70121000100000000000026a80121000100000000000026a90121000100000000000026aa0121000100000000000026ab0121000100000000000026ac0121000100000000000026ad0121000100000000000026ae0121000100000000000026af0121000100000000000026b00121000100000000000026b10121000100000000000026b20121000100000000000026b30121000100000000000026b40121000100000000000026b50121000100000000000026b60121000100000000000026b70121000100000000000026b80121000100000000000026b90121000100000000000026ba0121000100000000000026bb0121000100000000000026bc0121000100000000000026bd0121000100000000000026be0121000100000000000026bf0121000100000000000026c00121000100000000000026c10121000100000000000026c20121000100000000000026c30121000100000000000026c40121000100000000000026c50121000100000000000026c60121000100000000000026c70121000100000000000026c80121000100000000000026c90121000100000000000026ca0121000100000000000026cb0121000100000000000026cc0121000100000000000026cd0121000100000000000026ce0121000100000000000026cf0121000100000000000026d00121000100000000000026d10121000100000000000026d20121000100000000000026d30121000100000000000026d40121000100000000000026d50121000100000000000026d60121000100000000000026d70121000100000000000026d80121000100000000000026d90121000100000000000026da0121000100000000000026db0121000100000000000026dc0121000100000000000026dd0121000100000000000026de0121000100000000000026df0121000100000000000026e00121000100000000000026e10121000100000000000026e20121000100000000000026e30121000100000000000026e40121000100000000000026e50121000100000000000026e60121000100000000000026e70121000100000000000026e80121000100000000000026e90121000100000000000026ea0121000100000000000026eb0121000100000000000026ec0121000100000000000026ed0121000100000000000026ee0121000100000000000026ef0121000100000000000026f00121000100000000000026f10121000100000000000026f20121000100000000000026f30121000100000000000026f40121000100000000000026f50121000100000000000026f60121000100000000000026f70121000100000000000026f80121000100000000000026f90121000100000000000026fa0121000100000000000026fb0121000100000000000026fc0121000100000000000026fd0121000100000000000026fe0121000100000000000026ff01210001000000000000270001210001000000000000270101210001000000000000270201210001000000000000270301210001000000000000270401210001000000000000270501210001000000000000270601210001000000000000270701210001000000000000270801210001000000000000270901210001000000000000270a01210001000000000000270b01210001000000000000270c01210001000000000000270d01210001000000000000270e01210001000000000000270f01210001000000000000271001210021038004869696edc6120c67eb6f000a3e4e13d13ae10755e2f378ca9c250c0d6465706f7369745f62617463682101830020200020220100012101200741017bef0360750c2b1257a6aad07673f97b25bb97ac076e1f0c058ab592d282449e390d3985cf1dd8052516e6d7fc870a41757064c9a80d71211174f0e9724cab3622000121012007410069fe1e5e3f3667a6af147eda05133bc47d077d6e30e08236b341d834d74231271b9bd269087ea38b1fe707ba170d865c5932e169588a78362e052336eb3d1563 \ No newline at end of file diff --git a/benches/build.rs b/benches/build.rs deleted file mode 100644 index d987a32b..00000000 --- a/benches/build.rs +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100755 index 3c84f0a7..00000000 Binary files a/benches/lib/libradix_engine_toolkit.dylib and /dev/null differ diff --git a/benches/src/lib.rs b/benches/src/lib.rs deleted file mode 100644 index c04cf310..00000000 --- a/benches/src/lib.rs +++ /dev/null @@ -1,159 +0,0 @@ -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/build-specific.sh b/build-specific.sh deleted file mode 100755 index 0ba3b80b..00000000 --- a/build-specific.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -# This bash script is used to build a specific crate for a specific target triple given the custom -# linker, compiler, and archiver to use. The parameters are defined through environment variables -# which this script makes use of. The following is a list of the environment variables that this -# script requires: -# -# 1. CRATE_NAME: This is the name of the crate to build (e.g.: native-json-interface) -# 2. TARGET_TRIPLE: The target to build the radix engine toolkit for (e.g. aarch64-apple-darwin) -# 3. CUSTOM_COMPILER: The custom compiler to use to use for this build. When unsure, set this to the -# path of your current clang binary and try running this script (e.g. /usr/bin/clang) -# 4. CUSTOM_ARCHIVER: The custom archiver to use to use for this build. When unsure, set this to the -# path of your current llvm-ar binary and try running this script (e.g. /usr/bin/llvm-ar) -# 5. CUSTOM_LINKER: The custom linker to use to use for this build. When unsure, do not set this -# variable to anything and try running this script. This variable should not be needed for all -# targets. -# 6. FEATURES: A string of the features string to use for the build (e.g. `jni`) - -set -x -set -e - -# The path of the directory that this script is in. -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) - -# Setting the features to default if none are provided -FEATURES=${FEATURES:="default"} - -# A function which builds the create the current working directory for the specified target triple. -cargo_build() { - local target_triple=$1 - cargo +nightly build \ - -Z build-std=std,panic_abort \ - -Z build-std-features=panic_immediate_abort \ - --target $target_triple \ - --features $FEATURES \ - --release -} - -# Generates the CBindgen header for that specific target. -generate_cbindgen_header() { - local target_triple=$1 - local crate_path=$2 - - # Creating an include directory in the path of the target. This will store the header and the - # module map - INCLUDE_DIRECTORY_PATH="$crate_path/target/$target_triple/release/include" - mkdir $INCLUDE_DIRECTORY_PATH - - rustup default nightly - unset $LINKER_ENVIRONMENT_VARIABLE_NAME - CC=$(which clang) AR=$(which llvm-ar) cbindgen \ - --lang c \ - --config cbindgen.toml \ - --output "$INCLUDE_DIRECTORY_PATH/libradix_engine_toolkit.h" - rustup default stable - - # Create a module map which links to the generated header in the include directory - echo "module RadixEngineToolkit {" > "$INCLUDE_DIRECTORY_PATH/module.modulemap" - echo " umbrella header \"libradix_engine_toolkit.h\"" >> "$INCLUDE_DIRECTORY_PATH/module.modulemap" - echo " export *" >> "$INCLUDE_DIRECTORY_PATH/module.modulemap" - echo "}" >> "$INCLUDE_DIRECTORY_PATH/module.modulemap" -} - -# A function which is used to create a compressed zip file of the build artifacts for a given target -# and crate -package_and_compress_build() { - local target_triple=$1 - local crate_path=$2 - - ( - # The path where all of the build artifacts for this given crate and target triple can be found - BUILD_PATH="$crate_path/target/$target_triple/release" - cd $BUILD_PATH - - # Finding all of build artifacts which we want to zip up in a file - BUILD_ARTIFACTS_PATH=$(find . -type f \( -name "*.a" -o -name "*.dylib" -o -name "*.dll" -o -name "*.so" -o -name "*.d" -o -name "*.wasm" \) -maxdepth 1) - gtar -czf "./$target_triple.tar.gz" $BUILD_ARTIFACTS_PATH ./include - ) -} - -# The environment variable that cargo uses to specify the linter is dependent on the target triple. -# So, we need to perform some actions to get to that environment variable. -export LINKER_ENVIRONMENT_VARIABLE_NAME="CARGO_TARGET_"$(echo $TARGET_TRIPLE | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g')"_LINKER" - -# Setting the `LINKER_ENVIRONMENT_VARIABLE_NAME` environment variable only if a custom linker was -# specified. Otherwise, there is no need to set this environment variable. -if [ ! -z "$CUSTOM_LINKER" ] -then - export $LINKER_ENVIRONMENT_VARIABLE_NAME=$CUSTOM_LINKER -fi - -# Setting the CC and AR environment variables to the specified custom compiler and archiver -export CC=$CUSTOM_COMPILER -export AR=$CUSTOM_ARCHIVER - -# Go into the crate directory and run the build command -CRATE_PATH="$SCRIPT_DIR/$CRATE_NAME" -cd $CRATE_PATH - -cargo_build $TARGET_TRIPLE -generate_cbindgen_header $TARGET_TRIPLE $CRATE_PATH -package_and_compress_build $TARGET_TRIPLE $CRATE_PATH \ No newline at end of file diff --git a/build.sh b/build.sh deleted file mode 100755 index e0139715..00000000 --- a/build.sh +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -# This script is used to build the Radix Engine Toolkits and the various crates (interfaces) which -# exist for it. For this script to run suceessfully, there are a few environment variables which -# need to be set -# 1. LLVM_BIN_PATH: The path to the currently installed LLVM toolchain for your machine. If you are -# on MacOS, then you can install this through homebrew: `brew install llvm`. -# 2. NDK_BIN_PATH: The path to Android's Native Development Kit which is needed to be able to build -# the Radix Engine Toolkit for Android targets. Currently, the toolkit requires a minimum NDK -# version of 25 to be built. -# 3. MINGW_BIN_PATH: The path to the installation of the Mingw w64 toolchain. This is required to be -# able to cross-compile the Radix Engine Toolkit to an x86_64 Windows target. -# 4. LINUX_CROSS_BIN_PATH: The path to the installation of a linux cross compiler. The following is -# an example of where you can install that: -# https://stackoverflow.com/questions/40424255/cross-compilation-to-x86-64-unknown-linux-gnu-fails-on-mac-osx -# -# With these environment variables set, this script will utilize them to build the different crates -# of the Radix Engine Toolkit - -set -x -set -e - -# The path of the directory that the script is in. -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -# The name of the library that we are building -PACKAGE_NAME="radix-engine-toolkit" -# The package name after the - has been replaced with _ -CLEANED_PACKAGE_NAME=$(echo "$PACKAGE_NAME" | tr "-" "_") -# The library name. By convention, this is `lib` concatenated with the package name -LIBRARY_NAME="lib$CLEANED_PACKAGE_NAME" - -# =========================================== -# Building the "native-json-interface" crate -# =========================================== -( - # The name of the crate that we are building - export CRATE_NAME="native-json-interface" - - # Building the Radix Engine Toolkit for a `wasm32-unknown-unknown` target - echo "WASM" - export TARGET_TRIPLE="wasm32-unknown-unknown" - export CUSTOM_COMPILER="$LLVM_BIN_PATH/clang" - export CUSTOM_ARCHIVER="$LLVM_BIN_PATH/llvm-ar" - export CUSTOM_LINKER="" - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `aarch64-apple-darwin` target - echo "APPLE" - export TARGET_TRIPLE="aarch64-apple-darwin" - export CUSTOM_COMPILER="$LLVM_BIN_PATH/clang" - export CUSTOM_ARCHIVER="$LLVM_BIN_PATH/llvm-ar" - export CUSTOM_LINKER="" - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `x86_64-apple-darwin` target - export TARGET_TRIPLE="x86_64-apple-darwin" - export CUSTOM_COMPILER="$LLVM_BIN_PATH/clang" - export CUSTOM_ARCHIVER="$LLVM_BIN_PATH/llvm-ar" - export CUSTOM_LINKER="" - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `aarch64-apple-ios-sim` target - export TARGET_TRIPLE="aarch64-apple-ios-sim" - export CUSTOM_COMPILER="$LLVM_BIN_PATH/clang" - export CUSTOM_ARCHIVER="$LLVM_BIN_PATH/llvm-ar" - export CUSTOM_LINKER="" - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `aarch64-apple-ios` target - export TARGET_TRIPLE="aarch64-apple-ios" - export CUSTOM_COMPILER="$LLVM_BIN_PATH/clang" - export CUSTOM_ARCHIVER="$LLVM_BIN_PATH/llvm-ar" - export CUSTOM_LINKER="" - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `x86_64-apple-ios` target - export TARGET_TRIPLE="x86_64-apple-ios" - export CUSTOM_COMPILER="$LLVM_BIN_PATH/clang" - export CUSTOM_ARCHIVER="$LLVM_BIN_PATH/llvm-ar" - export CUSTOM_LINKER="" - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `x86_64-pc-windows-gnu` target - export TARGET_TRIPLE="x86_64-pc-windows-gnu" - export CUSTOM_COMPILER="$MINGW_BIN_PATH/x86_64-w64-mingw32-gcc" - export CUSTOM_ARCHIVER="$MINGW_BIN_PATH/x86_64-w64-mingw32-ar" - export CUSTOM_LINKER="" - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `x86_64-unknown-linux-gnu` target - export TARGET_TRIPLE="x86_64-unknown-linux-gnu" - export CUSTOM_COMPILER="$LLVM_BIN_PATH/clang" - export CUSTOM_ARCHIVER="$LLVM_BIN_PATH/llvm-ar" - export CUSTOM_LINKER="$LINUX_CROSS_BIN_PATH/x86_64-unknown-linux-gnu-gcc" - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `aarch64-linux-android` target - export TARGET_TRIPLE="aarch64-linux-android" - export CUSTOM_COMPILER="$NDK_BIN_PATH/aarch64-linux-android21-clang" - export CUSTOM_ARCHIVER="$NDK_BIN_PATH/llvm-ar" - export CUSTOM_LINKER=$CUSTOM_COMPILER - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `armv7-linux-androideabi` target - export TARGET_TRIPLE="armv7-linux-androideabi" - export CUSTOM_COMPILER="$NDK_BIN_PATH/armv7a-linux-androideabi19-clang" - export CUSTOM_ARCHIVER="$NDK_BIN_PATH/llvm-ar" - export CUSTOM_LINKER=$CUSTOM_COMPILER - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh - - # Building the Radix Engine Toolkit for a `i686-linux-android` target - export TARGET_TRIPLE="i686-linux-android" - export CUSTOM_COMPILER="$NDK_BIN_PATH/i686-linux-android19-clang" - export CUSTOM_ARCHIVER="$NDK_BIN_PATH/llvm-ar" - export CUSTOM_LINKER=$CUSTOM_COMPILER - export FEATURES="jni" - $SCRIPT_DIR/build-specific.sh -) - -# ================= -# Composite Builds -# ================= - -# Creating an XCFramework from the Apple builds -( - # The name of the crate that we are building - CRATE_NAME="native-json-interface" - - # The path of the crate - CRATE_PATH="$SCRIPT_DIR/$CRATE_NAME" - - cd $CRATE_PATH - - # Creating the two directories where the temporary FAT libraries will be stored - mkdir $CRATE_PATH/target/macos-arm64_x86_64/ - mkdir $CRATE_PATH/target/ios-simulator-arm64_x86_64 - - # Creating the fat libraries - lipo -create \ - "$CRATE_PATH/target/aarch64-apple-darwin/release/$LIBRARY_NAME.a" \ - "$CRATE_PATH/target/x86_64-apple-darwin/release/$LIBRARY_NAME.a" \ - -o "$CRATE_PATH/target/macos-arm64_x86_64/$LIBRARY_NAME.a" - lipo -create \ - "$CRATE_PATH/target/aarch64-apple-ios-sim/release/$LIBRARY_NAME.a" \ - "$CRATE_PATH/target/x86_64-apple-ios/release/$LIBRARY_NAME.a" \ - -o "$CRATE_PATH/target/ios-simulator-arm64_x86_64/$LIBRARY_NAME.a" - - # Copying the "include" directory from its origin into the fat library directory - cp -r $CRATE_PATH/target/aarch64-apple-darwin/release/include $CRATE_PATH/target/macos-arm64_x86_64/ - cp -r $CRATE_PATH/target/aarch64-apple-ios-sim/release/include $CRATE_PATH/target/ios-simulator-arm64_x86_64/ - - # Creating the XC Framework - xcodebuild -create-xcframework \ - -library "$CRATE_PATH/target/aarch64-apple-ios/release/$LIBRARY_NAME.a" \ - -headers "$CRATE_PATH/target/aarch64-apple-ios/release/include" \ - -library "$CRATE_PATH/target/macos-arm64_x86_64/$LIBRARY_NAME.a" \ - -headers "$CRATE_PATH/target/macos-arm64_x86_64/include" \ - -library "$CRATE_PATH/target/ios-simulator-arm64_x86_64/$LIBRARY_NAME.a" \ - -headers "$CRATE_PATH/target/ios-simulator-arm64_x86_64/include" \ - -output "$CRATE_PATH/target/RadixEngineToolkit.xcframework" - - # Deleting the temporary Fat libraries directories - rm -rf $CRATE_PATH/target/macos-arm64_x86_64/ - rm -rf $CRATE_PATH/target/ios-simulator-arm64_x86_64 -) - -# ====================== -# Aggregate and Collect -# ====================== - -BUILDS_DIRECTORY="$SCRIPT_DIR/build" -[[ -d $BUILDS_DIRECTORY ]] && rm -r $BUILDS_DIRECTORY -mkdir $BUILDS_DIRECTORY - -for crate_name in "radix-engine-toolkit-jni" "native-json-interface" "radix-engine-toolkit-wasm"; -do - CRATE_PATH="$SCRIPT_DIR/$crate_name" - TARGET_PATH="$CRATE_PATH/target" - - ARGUMENTS="" - for path in $(find $TARGET_PATH \( -name "*.xcframework" -o -name "*.tar.gz" \) -maxdepth 3); - do - ARTIFACT_DIRECTORY_PATH=$(cd $(dirname $path); pwd) - ARTIFACT_FILE_NAME=$(basename $path) - - ARGUMENTS+=" -C $ARTIFACT_DIRECTORY_PATH $ARTIFACT_FILE_NAME " - done - gtar -czf "$BUILDS_DIRECTORY/$crate_name.tar.gz" $ARGUMENTS -done \ No newline at end of file diff --git a/cli-json-interface/Cargo.toml b/cli-json-interface/Cargo.toml deleted file mode 100644 index a778f789..00000000 --- a/cli-json-interface/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[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 deleted file mode 100644 index a14c36cd..00000000 --- a/cli-json-interface/src/cli.rs +++ /dev/null @@ -1,37 +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. - -#[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 deleted file mode 100644 index 95772e64..00000000 --- a/cli-json-interface/src/error.rs +++ /dev/null @@ -1,74 +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(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/subcommands/address/babylon_address_from_olympia_address.rs b/cli-json-interface/src/subcommands/address/babylon_address_from_olympia_address.rs deleted file mode 100644 index 43d2aca5..00000000 --- a/cli-json-interface/src/subcommands/address/babylon_address_from_olympia_address.rs +++ /dev/null @@ -1,47 +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::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 deleted file mode 100644 index d9621bc3..00000000 --- a/cli-json-interface/src/subcommands/address/decode.rs +++ /dev/null @@ -1,39 +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::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 deleted file mode 100644 index d9d1c5cb..00000000 --- a/cli-json-interface/src/subcommands/address/encode.rs +++ /dev/null @@ -1,45 +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::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 deleted file mode 100644 index 27c22afb..00000000 --- a/cli-json-interface/src/subcommands/address/known_addresses.rs +++ /dev/null @@ -1,41 +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::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 deleted file mode 100644 index 9c039313..00000000 --- a/cli-json-interface/src/subcommands/address/mod.rs +++ /dev/null @@ -1,49 +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 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 deleted file mode 100644 index 31f8e128..00000000 --- a/cli-json-interface/src/subcommands/address/virtual_account_address.rs +++ /dev/null @@ -1,59 +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 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 deleted file mode 100644 index 49b684c2..00000000 --- a/cli-json-interface/src/subcommands/address/virtual_identity_address.rs +++ /dev/null @@ -1,59 +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 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/sbor/decode.rs b/cli-json-interface/src/subcommands/sbor/decode.rs deleted file mode 100644 index be10c7c6..00000000 --- a/cli-json-interface/src/subcommands/sbor/decode.rs +++ /dev/null @@ -1,44 +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::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 deleted file mode 100644 index 4c01095a..00000000 --- a/cli-json-interface/src/subcommands/sbor/encode.rs +++ /dev/null @@ -1,37 +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::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/transaction/analyze_manifest.rs b/cli-json-interface/src/subcommands/transaction/analyze_manifest.rs deleted file mode 100644 index 3fcbaf3b..00000000 --- a/cli-json-interface/src/subcommands/transaction/analyze_manifest.rs +++ /dev/null @@ -1,82 +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 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 deleted file mode 100644 index de2d6fd2..00000000 --- a/cli-json-interface/src/subcommands/transaction/convert_manifest.rs +++ /dev/null @@ -1,170 +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 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 deleted file mode 100644 index bcd7a2f8..00000000 --- a/cli-json-interface/src/subcommands/transaction/decompile.rs +++ /dev/null @@ -1,103 +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 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 deleted file mode 100644 index 04b22280..00000000 --- a/cli-json-interface/src/subcommands/transaction/mod.rs +++ /dev/null @@ -1,38 +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 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 deleted file mode 100644 index 9d7bbb12..00000000 --- a/cli-json-interface/src/subcommands/utils/hash.rs +++ /dev/null @@ -1,40 +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::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 deleted file mode 100644 index 8c22e26e..00000000 --- a/cli-json-interface/src/subcommands/utils/information.rs +++ /dev/null @@ -1,35 +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 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/utils.rs b/cli-json-interface/src/utils.rs deleted file mode 100644 index bb4599ae..00000000 --- a/cli-json-interface/src/utils.rs +++ /dev/null @@ -1,34 +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::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/example.sh b/example.sh new file mode 100755 index 00000000..6616b620 --- /dev/null +++ b/example.sh @@ -0,0 +1,9 @@ +runs_on="macos-latest" + +if [ $runs_on == "macos-latest" ]; then + echo "mac" +elif [ $runs_on == "linux-latest" ]; then + echo "linux" +else + echo "else" +fi \ No newline at end of file diff --git a/format.sh b/format.sh index eb84aec6..642be9e1 100755 --- a/format.sh +++ b/format.sh @@ -1,3 +1,2 @@ -cargo +nightly fmt -(cd native-json-interface; cargo +nightly fmt) -(cd cli-json-interface; cargo +nightly fmt) \ No newline at end of file +(cd radix-engine-toolkit-core; cargo +nightly fmt) +(cd radix-engine-toolkit; cargo +nightly fmt) \ No newline at end of file diff --git a/generator/Cargo.toml b/generator/Cargo.toml new file mode 100644 index 00000000..fe208e09 --- /dev/null +++ b/generator/Cargo.toml @@ -0,0 +1,43 @@ +[package] +name = "generator" +version = "0.1.0" +edition = "2021" + +[dependencies] +# radixdlt-scrypto dependencies. +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +scrypto-unit = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", default-features = false, features = ["lru", "std"] } +transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e" } +radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", default-features= false, features = ["std", "lru"] } +radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e" } + +# Core Radix Engine Toolkit and Toolkit Native Library +radix-engine-toolkit-core = { path = "../radix-engine-toolkit-core" } +radix-engine-toolkit = { path = "../radix-engine-toolkit" } + +# Serde dependencies +serde = { version = "1.0.163" } +serde_yaml = { version = "0.9.21" } +serde_json = { version = "1.0.96", features = ["preserve_order"] } +serde_with = { version = "3.0.0", features = ["hex"] } +schemars = { version = "0.8.12", features = ["preserve_order"] } +rocket_okapi = { git = "https://github.com/0xOmarA/okapi", tag = "0.8.0-rc.4", features = ["preserve_order"] } + +# Used to change the casing of strings +heck = { version = "0.4.1" } + +# Used in walking directories to get manifests +walkdir = { version = "2.3.3" } + +# Misc +indexmap = { version = "1.9.3" } + +[profile.release] +incremental = false +strip = true +panic = 'abort' +codegen-units = 1 +lto = true +opt-level = 'z' \ No newline at end of file diff --git a/rustfmt.toml b/generator/rustfmt.toml similarity index 100% rename from rustfmt.toml rename to generator/rustfmt.toml diff --git a/generator/src/function_examples/derive.rs b/generator/src/function_examples/derive.rs new file mode 100644 index 00000000..ef2de795 --- /dev/null +++ b/generator/src/function_examples/derive.rs @@ -0,0 +1,124 @@ +// 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::prelude::*; +use radix_engine_toolkit::prelude::*; +use transaction::prelude::*; + +use super::traits::HasExamples; + +impl<'f> HasExamples<'f, 2> for DeriveVirtualAccountAddressFromPublicKey { + fn example_inputs() -> [Self::Input; 2] { + let public_key1 = Secp256k1PrivateKey::from_u64(1).unwrap().public_key(); + let public_key2 = Ed25519PrivateKey::from_u64(1).unwrap().public_key(); + + [ + Self::Input { + public_key: PublicKey::from(public_key1).into(), + network_id: 1.into(), + }, + Self::Input { + public_key: PublicKey::from(public_key2).into(), + network_id: 1.into(), + }, + ] + } +} + +impl<'f> HasExamples<'f, 2> for DeriveVirtualIdentityAddressFromPublicKey { + fn example_inputs() -> [Self::Input; 2] { + let public_key1 = Secp256k1PrivateKey::from_u64(1).unwrap().public_key(); + let public_key2 = Ed25519PrivateKey::from_u64(1).unwrap().public_key(); + + [ + Self::Input { + public_key: PublicKey::from(public_key1).into(), + network_id: 1.into(), + }, + Self::Input { + public_key: PublicKey::from(public_key2).into(), + network_id: 1.into(), + }, + ] + } +} + +impl<'f> HasExamples<'f, 2> for DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKey { + fn example_inputs() -> [Self::Input; 2] { + let public_key1 = Secp256k1PrivateKey::from_u64(1).unwrap().public_key(); + let public_key2 = Ed25519PrivateKey::from_u64(1).unwrap().public_key(); + + [ + Self::Input { + public_key: PublicKey::from(public_key1).into(), + network_id: 1.into(), + }, + Self::Input { + public_key: PublicKey::from(public_key2).into(), + network_id: 1.into(), + }, + ] + } +} + +impl<'f> HasExamples<'f, 1> for DeriveVirtualAccountAddressFromOlympiaAccountAddress { + fn example_inputs() -> [Self::Input; 1] { + [Self::Input { + olympia_account_address: + "rdx1qspx7zxmnrh36q33av24srdfzg7m3cj65968erpjuh7ja3rm3kmn6hq4j9842".to_string(), + network_id: 1.into(), + }] + } +} + +impl<'f> HasExamples<'f, 1> for DeriveResourceAddressFromOlympiaResourceAddress { + fn example_inputs() -> [Self::Input; 1] { + [Self::Input { + olympia_resource_address: "floop_rr1q0p0hzap6ckxqdk6khesyft62w34e0vdd06msn9snhfqknl370" + .to_string(), + network_id: 1.into(), + }] + } +} + +impl<'f> HasExamples<'f, 1> for DerivePublicKeyFromOlympiaAccountAddress { + fn example_inputs() -> [Self::Input; 1] { + ["rdx1qspx7zxmnrh36q33av24srdfzg7m3cj65968erpjuh7ja3rm3kmn6hq4j9842".to_string()] + } +} + +impl<'f> HasExamples<'f, 1> for DeriveOlympiaAccountAddressFromPublicKey { + fn example_inputs() -> [Self::Input; 1] { + let public_key = Secp256k1PrivateKey::from_u64(1).unwrap().public_key(); + + [Self::Input { + public_key: public_key.into(), + olympia_network: SerializableOlympiaNetwork::Mainnet, + }] + } +} + +impl<'f> HasExamples<'f, 1> for DeriveNodeAddressFromPublicKey { + fn example_inputs() -> [Self::Input; 1] { + let public_key = Secp256k1PrivateKey::from_u64(1).unwrap().public_key(); + + [Self::Input { + public_key: public_key.into(), + network_id: 1.into(), + }] + } +} diff --git a/generator/src/function_examples/execution.rs b/generator/src/function_examples/execution.rs new file mode 100644 index 00000000..4159cb1e --- /dev/null +++ b/generator/src/function_examples/execution.rs @@ -0,0 +1,143 @@ +// 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::prelude::*; +use radix_engine_toolkit::prelude::*; +use scrypto::blueprints::account::*; +use scrypto_unit::*; +use transaction::prelude::*; + +use super::traits::HasExamples; + +impl<'f> HasExamples<'f, 3> for ExecutionAnalyze { + fn example_inputs() -> [Self::Input; 3] { + let op1 = { + let mut test_runner = TestRunner::builder().without_trace().build(); + let (public_key1, _, account1) = test_runner.new_account(true); + let (public_key2, _, account2) = test_runner.new_account(true); + + let manifest = ManifestBuilder::new() + .lock_fee(account1, "10") + .withdraw_from_account(account1, RADIX_TOKEN, "10") + .take_from_worktop(RADIX_TOKEN, "10", "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method( + account2, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .build(); + let receipt = test_runner.preview_manifest( + manifest.clone(), + vec![public_key1.into(), public_key2.into()], + 0, + PreviewFlags::default(), + ); + receipt.expect_commit_success(); + + (manifest, receipt) + }; + + let op2 = { + let mut test_runner = TestRunner::builder().without_trace().build(); + let (public_key1, _, account1) = test_runner.new_account(true); + let (public_key2, _, account2) = test_runner.new_account(true); + let (public_key3, _, account3) = test_runner.new_account(true); + + let manifest = ManifestBuilder::new() + .lock_fee(account1, "10") + .withdraw_from_account(account1, RADIX_TOKEN, "20") + .take_from_worktop(RADIX_TOKEN, "10", "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method( + account2, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .take_from_worktop(RADIX_TOKEN, "10", "bucket1") + .with_bucket("bucket1", |builder, bucket| { + builder.call_method( + account3, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .build(); + let receipt = test_runner.preview_manifest( + manifest.clone(), + vec![public_key1.into(), public_key2.into(), public_key3.into()], + 0, + PreviewFlags::default(), + ); + receipt.expect_commit_success(); + + (manifest, receipt) + }; + + let op3 = { + let mut test_runner = TestRunner::builder().without_trace().build(); + let (public_key1, _, account1) = test_runner.new_account(true); + let (public_key2, _, account2) = test_runner.new_account(true); + let (public_key3, _, account3) = test_runner.new_account(true); + + let manifest = ManifestBuilder::new() + .lock_fee(account1, "10") + .withdraw_from_account(account1, RADIX_TOKEN, "10") + .withdraw_from_account(account2, RADIX_TOKEN, "10") + .take_from_worktop(RADIX_TOKEN, "10", "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method( + account2, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .take_from_worktop(RADIX_TOKEN, "10", "bucket1") + .with_bucket("bucket1", |builder, bucket| { + builder.call_method( + account3, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .build(); + let receipt = test_runner.preview_manifest( + manifest.clone(), + vec![public_key1.into(), public_key2.into(), public_key3.into()], + 0, + PreviewFlags::default(), + ); + receipt.expect_commit_success(); + + (manifest, receipt) + }; + + [op1, op2, op3].map(|(manifest, receipt)| { + let instructions = to_serializable_instructions(&manifest.instructions, 0xf2).unwrap(); + let instructions = SerializableInstructions::Parsed(instructions); + let preview_receipt = scrypto_encode(&receipt).unwrap(); + + Self::Input { + instructions, + network_id: 0xf2.into(), + preview_receipt: preview_receipt.into(), + } + }) + } +} diff --git a/generator/src/function_examples/generator.rs b/generator/src/function_examples/generator.rs new file mode 100644 index 00000000..c4d93ccf --- /dev/null +++ b/generator/src/function_examples/generator.rs @@ -0,0 +1,102 @@ +// 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::traits::FunctionExample; +use indexmap::{indexmap, IndexMap}; +use radix_engine_toolkit::prelude::*; + +#[allow(clippy::type_complexity)] +pub fn generate_function_examples() -> IndexMap< + &'static str, + IndexMap>>, +> { + indexmap!( + "information" => function_examples![ + BuildInformation + ], + "derive" => function_examples![ + DeriveVirtualAccountAddressFromPublicKey, + DeriveVirtualIdentityAddressFromPublicKey, + DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKey, + DeriveVirtualAccountAddressFromOlympiaAccountAddress, + DeriveResourceAddressFromOlympiaResourceAddress, + DerivePublicKeyFromOlympiaAccountAddress, + DeriveOlympiaAccountAddressFromPublicKey, + DeriveNodeAddressFromPublicKey, + ], + "instructions" => function_examples![ + InstructionsHash, + InstructionsConvert, + InstructionsCompile, + InstructionsDecompile, + InstructionsStaticallyValidate, + InstructionsExtractAddresses, + ], + "execution" => function_examples![ + ExecutionAnalyze + ], + "manifest" => function_examples![ + ManifestHash, + ManifestCompile, + ManifestDecompile, + ManifestStaticallyValidate, + ], + "intent" => function_examples![ + IntentHash, + IntentCompile, + IntentDecompile, + IntentStaticallyValidate, + ], + "signed_intent" => function_examples![ + SignedIntentHash, + SignedIntentCompile, + SignedIntentDecompile, + SignedIntentStaticallyValidate, + ], + "notarized_transaction" => function_examples![ + NotarizedTransactionHash, + NotarizedTransactionCompile, + NotarizedTransactionDecompile, + NotarizedTransactionStaticallyValidate, + ], + "utils" => function_examples![ + UtilsKnownAddress + ] + ) +} + +macro_rules! function_examples { + ( + $( $function: ident ),* $(,)? + ) => { + { + use $crate::function_examples::traits::HasExamples; + + let mut map = indexmap::IndexMap::new(); + + $( + let name = $function::function_name(); + let examples = $function::serde_value_examples().into_iter().collect::>(); + + map.insert(name, examples); + )* + + map + } + }; +} +use function_examples; diff --git a/generator/src/function_examples/information.rs b/generator/src/function_examples/information.rs new file mode 100644 index 00000000..999772fe --- /dev/null +++ b/generator/src/function_examples/information.rs @@ -0,0 +1,25 @@ +// 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::traits::HasExamples; +use radix_engine_toolkit::functions::information::*; + +impl<'f> HasExamples<'f, 1> for BuildInformation { + fn example_inputs() -> [Self::Input; 1] { + [BuildInformationInput {}] + } +} diff --git a/generator/src/function_examples/instructions.rs b/generator/src/function_examples/instructions.rs new file mode 100644 index 00000000..83d12690 --- /dev/null +++ b/generator/src/function_examples/instructions.rs @@ -0,0 +1,109 @@ +// 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::prelude::*; +use radix_engine_toolkit::prelude::*; + +use super::manifest_provider::*; +use super::traits::HasExamples; + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for InstructionsHash { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + InstructionsConvert::example_inputs().map( + |InstructionsConvertInput { + instructions, + network_id, + .. + }| Self::Input { + instructions, + network_id, + }, + ) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for InstructionsConvert { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + get_serializable_instructions().map(|instructions| { + let other_kind = match instructions { + SerializableInstructions::Parsed(..) => SerializableInstructionsKind::String, + SerializableInstructions::String(..) => SerializableInstructionsKind::Parsed, + }; + + Self::Input { + instructions, + network_id: 0xf2.into(), + instructions_kind: other_kind, + } + }) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for InstructionsCompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + InstructionsConvert::example_inputs().map( + |InstructionsConvertInput { + instructions, + network_id, + .. + }| Self::Input { + instructions, + network_id, + }, + ) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for InstructionsDecompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + InstructionsCompile::example_outputs().map(|output| InstructionsDecompileInput { + compiled: output, + instructions_kind: SerializableInstructionsKind::String, + network_id: 0xf2.into(), + }) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for InstructionsStaticallyValidate { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + InstructionsConvert::example_inputs().map( + |InstructionsConvertInput { + instructions, + network_id, + .. + }| Self::Input { + instructions, + network_id, + }, + ) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for InstructionsExtractAddresses { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + InstructionsConvert::example_inputs().map( + |InstructionsConvertInput { + instructions, + network_id, + .. + }| Self::Input { + instructions, + network_id, + }, + ) + } +} diff --git a/generator/src/function_examples/intent.rs b/generator/src/function_examples/intent.rs new file mode 100644 index 00000000..0c0f2106 --- /dev/null +++ b/generator/src/function_examples/intent.rs @@ -0,0 +1,54 @@ +// 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::prelude::*; +use transaction::validation::ValidationConfig; + +use super::manifest_provider::*; +use super::traits::HasExamples; + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for IntentHash { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionHash::example_inputs().map(|tx| tx.signed_intent.intent) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for IntentCompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionHash::example_inputs().map(|tx| tx.signed_intent.intent) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for IntentDecompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + IntentCompile::example_outputs().map(|output| IntentDecompileInput { + compiled: output, + instructions_kind: SerializableInstructionsKind::String, + }) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for IntentStaticallyValidate { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionHash::example_inputs() + .map(|tx| tx.signed_intent.intent) + .map(|transaction| Self::Input { + intent: transaction, + validation_config: ValidationConfig::default(0xf2).into(), + }) + } +} diff --git a/generator/src/function_examples/manifest.rs b/generator/src/function_examples/manifest.rs new file mode 100644 index 00000000..a414802b --- /dev/null +++ b/generator/src/function_examples/manifest.rs @@ -0,0 +1,64 @@ +// 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::prelude::*; + +use super::manifest_provider::*; +use super::traits::HasExamples; + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for ManifestHash { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionHash::example_inputs() + .map(|tx| tx.signed_intent.intent.manifest) + .map(|transaction| Self::Input { + manifest: transaction, + network_id: 0xf2.into(), + }) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for ManifestCompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionHash::example_inputs() + .map(|tx| tx.signed_intent.intent.manifest) + .map(|transaction| Self::Input { + manifest: transaction, + network_id: 0xf2.into(), + }) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for ManifestDecompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + ManifestCompile::example_outputs().map(|output| ManifestDecompileInput { + compiled: output, + instructions_kind: SerializableInstructionsKind::String, + network_id: 0xf2.into(), + }) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for ManifestStaticallyValidate { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionHash::example_inputs() + .map(|tx| tx.signed_intent.intent.manifest) + .map(|transaction| Self::Input { + manifest: transaction, + network_id: 0xf2.into(), + }) + } +} diff --git a/generator/src/function_examples/manifest_provider.rs b/generator/src/function_examples/manifest_provider.rs new file mode 100644 index 00000000..f4f7d29d --- /dev/null +++ b/generator/src/function_examples/manifest_provider.rs @@ -0,0 +1,58 @@ +// 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::prelude::*; +use radix_engine_toolkit::prelude::*; +use transaction::manifest::*; +use walkdir::WalkDir; + +pub const NUMBER_OF_MANIFESTS: usize = 26; +pub const NUMBER_OF_MANIFESTS_DOUBLE: usize = NUMBER_OF_MANIFESTS * 2; + +pub fn get_serializable_instructions() -> [SerializableInstructions; NUMBER_OF_MANIFESTS_DOUBLE] { + let mut output = Vec::new(); + + let path = "../radix-engine-toolkit/tests/manifests"; + for entry in WalkDir::new(path) { + let path = entry.unwrap().path().canonicalize().unwrap(); + + if path.extension().and_then(|str| str.to_str()) != Some("rtm") { + continue; + } + + let manifest_string = std::fs::read_to_string(&path).unwrap(); + let manifest = compile( + &manifest_string, + &NetworkDefinition::simulator(), + MockBlobProvider::new(), + ) + .unwrap(); + + let mut instructions = SerializableInstructions::Parsed( + to_serializable_instructions(&manifest.instructions, 0xf2).unwrap(), + ); + output.push(instructions.clone()); + + instructions + .convert_serializable_instructions_kind(SerializableInstructionsKind::String, 0xf2) + .unwrap(); + + output.push(instructions.clone()); + } + + output.try_into().unwrap() +} diff --git a/radix-engine-toolkit/src/example/mod.rs b/generator/src/function_examples/mod.rs similarity index 76% rename from radix-engine-toolkit/src/example/mod.rs rename to generator/src/function_examples/mod.rs index 7faa2cb5..6ac217c3 100644 --- a/radix-engine-toolkit/src/example/mod.rs +++ b/generator/src/function_examples/mod.rs @@ -15,12 +15,15 @@ // 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; +pub mod derive; +pub mod execution; +pub mod generator; +pub mod information; +pub mod instructions; +pub mod intent; +pub mod manifest; +pub mod manifest_provider; +pub mod notarized_transaction; +pub mod signed_intent; +pub mod traits; +pub mod utils; diff --git a/generator/src/function_examples/notarized_transaction.rs b/generator/src/function_examples/notarized_transaction.rs new file mode 100644 index 00000000..c6e2f0d3 --- /dev/null +++ b/generator/src/function_examples/notarized_transaction.rs @@ -0,0 +1,99 @@ +// 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::types::*; +use radix_engine_toolkit::prelude::*; +use transaction::prelude::{ + Ed25519PrivateKey, Secp256k1PrivateKey, TransactionBuilder, TransactionHeaderV1, + TransactionManifestV1, +}; +use transaction::validation::ValidationConfig; + +use super::manifest_provider::*; +use super::traits::HasExamples; + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for NotarizedTransactionHash { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + notarized_transactions() + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for NotarizedTransactionCompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + notarized_transactions() + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for NotarizedTransactionDecompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionCompile::example_outputs().map(|output| { + NotarizedTransactionDecompileInput { + compiled: output, + instructions_kind: SerializableInstructionsKind::String, + } + }) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for NotarizedTransactionStaticallyValidate { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + notarized_transactions().map(|transaction| Self::Input { + notarized_transaction: transaction, + validation_config: ValidationConfig::default(0xf2).into(), + }) + } +} + +fn build_transaction(instructions: SerializableInstructions) -> SerializableNotarizedTransaction { + let instructions_kind = match instructions { + SerializableInstructions::String(..) => SerializableInstructionsKind::String, + SerializableInstructions::Parsed(..) => SerializableInstructionsKind::Parsed, + }; + let instructions = instructions.to_instructions(0xf2).unwrap(); + let manifest = TransactionManifestV1 { + instructions, + blobs: Default::default(), + }; + + let notary_private_key = Secp256k1PrivateKey::from_u64(1).unwrap(); + let signer1_private_key = Secp256k1PrivateKey::from_u64(2).unwrap(); + let signer2_private_key = Ed25519PrivateKey::from_u64(2).unwrap(); + + let header = TransactionHeaderV1 { + network_id: 0xf2, + nonce: 100, + end_epoch_exclusive: Epoch::of(100), + start_epoch_inclusive: Epoch::of(90), + notary_is_signatory: true, + notary_public_key: notary_private_key.public_key().into(), + tip_percentage: 0, + }; + + let transaction = TransactionBuilder::new() + .manifest(manifest) + .header(header) + .sign(&signer1_private_key) + .sign(&signer2_private_key) + .notarize(¬ary_private_key) + .build(); + + SerializableNotarizedTransaction::from_native(&transaction, 0xf2, instructions_kind).unwrap() +} + +pub fn notarized_transactions() -> [SerializableNotarizedTransaction; NUMBER_OF_MANIFESTS_DOUBLE] { + get_serializable_instructions().map(build_transaction) +} diff --git a/generator/src/function_examples/signed_intent.rs b/generator/src/function_examples/signed_intent.rs new file mode 100644 index 00000000..ccd2625d --- /dev/null +++ b/generator/src/function_examples/signed_intent.rs @@ -0,0 +1,54 @@ +// 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::prelude::*; +use transaction::validation::ValidationConfig; + +use super::manifest_provider::*; +use super::traits::HasExamples; + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for SignedIntentHash { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionHash::example_inputs().map(|tx| tx.signed_intent) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for SignedIntentCompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionHash::example_inputs().map(|tx| tx.signed_intent) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for SignedIntentDecompile { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + SignedIntentCompile::example_outputs().map(|output| SignedIntentDecompileInput { + compiled: output, + instructions_kind: SerializableInstructionsKind::String, + }) + } +} + +impl<'f> HasExamples<'f, NUMBER_OF_MANIFESTS_DOUBLE> for SignedIntentStaticallyValidate { + fn example_inputs() -> [Self::Input; NUMBER_OF_MANIFESTS_DOUBLE] { + NotarizedTransactionHash::example_inputs() + .map(|tx| tx.signed_intent) + .map(|transaction| Self::Input { + signed_intent: transaction, + validation_config: ValidationConfig::default(0xf2).into(), + }) + } +} diff --git a/generator/src/function_examples/traits.rs b/generator/src/function_examples/traits.rs new file mode 100644 index 00000000..76cd0bf3 --- /dev/null +++ b/generator/src/function_examples/traits.rs @@ -0,0 +1,67 @@ +// 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::functions::traits::Function; +use serde::{Deserialize, Serialize}; + +use crate::utils; + +pub(super) trait HasExamples<'f, const N: usize> +where + Self: Function<'f> + Sized, +{ + fn function_name() -> String { + utils::snake_case_type_name::() + } + + fn example_inputs() -> [Self::Input; N]; + + fn example_outputs() -> [Self::Output; N] { + Self::example_inputs().map(|input| Self::handle(input).unwrap()) + } + + fn examples() -> [FunctionExample; N] { + unwrap_or_panic( + Self::example_inputs() + .into_iter() + .zip(Self::example_outputs().into_iter()) + .map(|(input, output)| FunctionExample { input, output }) + .collect::>() + .try_into(), + ) + } + + fn serde_value_examples() -> [FunctionExample; N] { + Self::examples().map(|example| FunctionExample { + input: serde_json::to_value(example.input).unwrap(), + output: serde_json::to_value(example.output).unwrap(), + }) + } +} + +#[derive(Serialize, Deserialize)] +pub struct FunctionExample { + input: I, + output: O, +} + +fn unwrap_or_panic(result: Result) -> O { + match result { + Ok(value) => value, + Err(_) => panic!("Unwrap error"), + } +} diff --git a/generator/src/function_examples/utils.rs b/generator/src/function_examples/utils.rs new file mode 100644 index 00000000..a797d138 --- /dev/null +++ b/generator/src/function_examples/utils.rs @@ -0,0 +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 super::traits::HasExamples; +use radix_engine_toolkit::prelude::*; + +impl<'f> HasExamples<'f, 0xFF> for UtilsKnownAddress { + fn example_inputs() -> [Self::Input; 0xFF] { + (1u8..=0xFFu8) + .map(Into::into) + .collect::>() + .try_into() + .unwrap() + } +} diff --git a/generator/src/function_schema/generator.rs b/generator/src/function_schema/generator.rs new file mode 100644 index 00000000..3ff0f77f --- /dev/null +++ b/generator/src/function_schema/generator.rs @@ -0,0 +1,106 @@ +// 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 indexmap::{indexmap, IndexMap}; +use radix_engine_toolkit::prelude::*; +use schemars::schema::RootSchema; + +pub fn generate_function_schema( +) -> IndexMap<&'static str, IndexMap> { + indexmap!( + "information" => function_schema![ + BuildInformation, + ], + "derive" => function_schema![ + DeriveVirtualAccountAddressFromPublicKey, + DeriveVirtualIdentityAddressFromPublicKey, + DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKey, + DeriveVirtualAccountAddressFromOlympiaAccountAddress, + DeriveResourceAddressFromOlympiaResourceAddress, + DerivePublicKeyFromOlympiaAccountAddress, + DeriveOlympiaAccountAddressFromPublicKey, + DeriveNodeAddressFromPublicKey, + ], + "instructions" => function_schema![ + InstructionsHash, + InstructionsConvert, + InstructionsCompile, + InstructionsDecompile, + InstructionsStaticallyValidate, + InstructionsExtractAddresses, + ], + "execution" => function_schema![ + ExecutionAnalyze + ], + "manifest" => function_schema![ + ManifestHash, + ManifestCompile, + ManifestDecompile, + ManifestStaticallyValidate, + ], + "intent" => function_schema![ + IntentHash, + IntentCompile, + IntentDecompile, + IntentStaticallyValidate, + ], + "signed_intent" => function_schema![ + SignedIntentHash, + SignedIntentCompile, + SignedIntentDecompile, + SignedIntentStaticallyValidate, + ], + "notarized_transaction" => function_schema![ + NotarizedTransactionHash, + NotarizedTransactionCompile, + NotarizedTransactionDecompile, + NotarizedTransactionStaticallyValidate, + ], + "utils" => function_schema![ + UtilsKnownAddress + ], + "scrypto_sbor" => function_schema![ + ScryptoSborDecodeToString + ], + "manifest_sbor" => function_schema![ + ManifestSborDecodeToString + ] + ) +} + +macro_rules! function_schema { + ( + $( $function: ident ),* $(,)? + ) => { + { + let mut map = indexmap::IndexMap::new(); + + $( + + let name = $crate::utils::snake_case_type_name::<$function>(); + + let input_schema = schemars::schema_for!(<$function as radix_engine_toolkit::functions::traits::Function>::Input); + let output_schema = schemars::schema_for!(<$function as radix_engine_toolkit::functions::traits::Function>::Output); + + map.insert(name, (input_schema, output_schema)); + )* + + map + } + }; +} +use function_schema; diff --git a/radix-engine-toolkit/src/example/engine_identifier/mod.rs b/generator/src/function_schema/mod.rs similarity index 96% rename from radix-engine-toolkit/src/example/engine_identifier/mod.rs rename to generator/src/function_schema/mod.rs index ad671178..29ad4b88 100644 --- a/radix-engine-toolkit/src/example/engine_identifier/mod.rs +++ b/generator/src/function_schema/mod.rs @@ -15,4 +15,4 @@ // specific language governing permissions and limitations // under the License. -pub mod transient_identifier; +pub mod generator; diff --git a/generator/src/function_spec/generator.rs b/generator/src/function_spec/generator.rs new file mode 100644 index 00000000..5ac45c43 --- /dev/null +++ b/generator/src/function_spec/generator.rs @@ -0,0 +1,77 @@ +// 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::prelude::*; +use rocket_okapi::okapi::openapi3::OpenApi; + +pub fn generate_function_spec() -> OpenApi { + open_api_spec![ + BuildInformation, + DeriveVirtualAccountAddressFromPublicKey, + DeriveVirtualIdentityAddressFromPublicKey, + DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKey, + DeriveVirtualAccountAddressFromOlympiaAccountAddress, + DeriveResourceAddressFromOlympiaResourceAddress, + DerivePublicKeyFromOlympiaAccountAddress, + DeriveOlympiaAccountAddressFromPublicKey, + DeriveNodeAddressFromPublicKey, + InstructionsHash, + InstructionsConvert, + InstructionsCompile, + InstructionsDecompile, + InstructionsStaticallyValidate, + InstructionsExtractAddresses, + ExecutionAnalyze, + ManifestHash, + ManifestCompile, + ManifestDecompile, + ManifestStaticallyValidate, + IntentHash, + IntentCompile, + IntentDecompile, + IntentStaticallyValidate, + SignedIntentHash, + SignedIntentCompile, + SignedIntentDecompile, + SignedIntentStaticallyValidate, + NotarizedTransactionHash, + NotarizedTransactionCompile, + NotarizedTransactionDecompile, + NotarizedTransactionStaticallyValidate, + UtilsKnownAddress, + ScryptoSborDecodeToString, + ManifestSborDecodeToString + ] +} + +macro_rules! open_api_spec { + ( + $( + $type: ty + ),* $(,)? + ) => { + { + let mut generator = rocket_okapi::gen::OpenApiGenerator::new(&Default::default()); + $( + generator.json_schema::<<$type as radix_engine_toolkit::functions::traits::Function>::Input>(); + generator.json_schema::<<$type as radix_engine_toolkit::functions::traits::Function>::Output>(); + )* + generator.into_openapi() + } + }; +} +use open_api_spec; diff --git a/radix-engine-toolkit/src/example/address/mod.rs b/generator/src/function_spec/mod.rs similarity index 94% rename from radix-engine-toolkit/src/example/address/mod.rs rename to generator/src/function_spec/mod.rs index 72df4c21..29ad4b88 100644 --- a/radix-engine-toolkit/src/example/address/mod.rs +++ b/generator/src/function_spec/mod.rs @@ -15,5 +15,4 @@ // specific language governing permissions and limitations // under the License. -pub mod entity_address; -pub mod non_fungible; +pub mod generator; diff --git a/generator/src/main.rs b/generator/src/main.rs new file mode 100644 index 00000000..2c0b1ab8 --- /dev/null +++ b/generator/src/main.rs @@ -0,0 +1,140 @@ +// 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 function_examples; +mod function_schema; +mod function_spec; +mod serializable_models; +mod utils; + +use crate::function_examples::generator::generate_function_examples; +use function_schema::generator::generate_function_schema; +use function_spec::generator::generate_function_spec; +use serializable_models::generator::generate_serializable_model_examples; +use std::path::{Path, PathBuf}; +use std::str::FromStr; +use utils::convert_open_api_adts_to_discriminated_unions; + +fn main() { + let output_directory = { + let manifest_directory = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + manifest_directory.join("output") + }; + std::fs::create_dir_all(&output_directory).unwrap(); + + // Generating the function examples + { + let output_directory = output_directory.join("function_examples"); + std::fs::create_dir_all(&output_directory).unwrap(); + + let function_examples = generate_function_examples(); + for (module, examples) in function_examples { + let output_path = output_directory.join(format!("{module}.json")); + let serialized = serde_json::to_string_pretty(&examples).unwrap(); + + std::fs::write(output_path, serialized).unwrap(); + } + } + + // Generating the function JSON schema + { + let output_directory = output_directory.join("function_json_schema"); + std::fs::create_dir_all(&output_directory).unwrap(); + + let function_examples = generate_function_schema(); + for (module, functions) in function_examples { + let output_directory = output_directory.join(module); + + for (function_name, (input_schema, output_schema)) in functions { + let output_directory = output_directory.join(function_name); + std::fs::create_dir_all(&output_directory).unwrap(); + + { + let output_path = output_directory.join("Input.json"); + let serialized = serde_json::to_string_pretty(&input_schema).unwrap(); + std::fs::write(output_path, serialized).unwrap(); + } + + { + let output_path = output_directory.join("Output.json"); + let serialized = serde_json::to_string_pretty(&output_schema).unwrap(); + std::fs::write(output_path, serialized).unwrap(); + } + } + } + } + + // Generating the model examples + { + let output_directory = output_directory.join("serializable_model_examples"); + std::fs::create_dir_all(&output_directory).unwrap(); + + let serializable_models_examples = generate_serializable_model_examples(); + for (path_extension, examples) in serializable_models_examples { + let output_directory = output_directory.join(path_extension); + std::fs::create_dir_all(&output_directory).unwrap(); + + for (file_name, examples) in examples { + let output_path = output_directory.join(format!("{file_name}.json")); + let serialized = serde_json::to_string_pretty(&examples).unwrap(); + std::fs::write(output_path, serialized).unwrap(); + } + } + } + + // Generating the manifest test vectors + { + let output_directory = output_directory.join("manifests"); + std::fs::create_dir_all(&output_directory).unwrap(); + + let manifest_directory = Path::new("../radix-engine-toolkit/tests/manifests") + .canonicalize() + .unwrap(); + + for entry in walkdir::WalkDir::new(&manifest_directory) { + let path = entry.unwrap().path().canonicalize().unwrap(); + if path.extension().and_then(|str| str.to_str()) != Some("rtm") { + continue; + } + + let output_directory = + PathBuf::from_str(&path.parent().unwrap().to_str().unwrap().replace( + manifest_directory.to_str().unwrap(), + output_directory.to_str().unwrap(), + )) + .unwrap(); + std::fs::create_dir_all(&output_directory).unwrap(); + + let output_path = output_directory.join(path.file_name().unwrap()); + std::fs::copy(path, output_path).unwrap(); + } + } + + // Generating the OpenAPI spec + { + let output_directory = output_directory.join("function_spec"); + std::fs::create_dir_all(&output_directory).unwrap(); + + let mut spec = generate_function_spec(); + spec.info.title = "Radix Engine Toolkit".to_string(); + + let output_path = output_directory.join("spec.yaml"); + let serialized = + serde_yaml::to_string(&convert_open_api_adts_to_discriminated_unions(&spec)).unwrap(); + std::fs::write(output_path, serialized).unwrap(); + } +} diff --git a/generator/src/serializable_models/cryptographic.rs b/generator/src/serializable_models/cryptographic.rs new file mode 100644 index 00000000..6a8f0448 --- /dev/null +++ b/generator/src/serializable_models/cryptographic.rs @@ -0,0 +1,184 @@ +// 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::prelude::PublicKey; +use radix_engine_toolkit::prelude::*; +use scrypto::prelude::{hash, Hash}; +use transaction::prelude::{ + Ed25519PrivateKey, Secp256k1PrivateKey, SignatureV1, SignatureWithPublicKeyV1, +}; + +use super::traits::HasExamples; + +impl<'f> HasExamples<'f> for SerializablePublicKey { + fn examples() -> Vec { + vec![ + Self::Secp256k1 { + value: Secp256k1PrivateKey::from_u64(1) + .unwrap() + .public_key() + .0 + .into(), + }, + Self::Ed25519 { + value: Ed25519PrivateKey::from_u64(1) + .unwrap() + .public_key() + .0 + .into(), + }, + ] + } +} + +impl<'f> HasExamples<'f> for SerializableSecp256k1PublicKey { + fn examples() -> Vec { + vec![Secp256k1PrivateKey::from_u64(1) + .unwrap() + .public_key() + .into()] + } +} + +impl<'f> HasExamples<'f> for SerializableEd25519PublicKey { + fn examples() -> Vec { + vec![Ed25519PrivateKey::from_u64(1).unwrap().public_key().into()] + } +} + +impl<'f> HasExamples<'f> for SerializableSignature { + fn examples() -> Vec { + let message = Message::PlainMessage(b"Hello World"); + private_keys() + .into_iter() + .map(|private_key| private_key.sign_to_signature(message).into()) + .collect() + } +} + +impl<'f> HasExamples<'f> for SerializableSignatureWithPublicKey { + fn examples() -> Vec { + let message = Message::PlainMessage(b"Hello World"); + private_keys() + .into_iter() + .map(|private_key| { + private_key + .sign_to_signature_with_public_key(message) + .into() + }) + .collect() + } +} + +impl<'f> HasExamples<'f> for SerializablePublicKeyHash { + fn examples() -> Vec { + private_keys() + .into_iter() + .map(|private_key| private_key.public_key().into()) + .collect() + } +} + +impl<'f> HasExamples<'f> for SerializableHash { + fn examples() -> Vec { + vec![b"Hello World".to_vec(), b"Hey World".to_vec()] + .into_iter() + .map(hash) + .map(Into::into) + .collect() + } +} + +fn private_keys() -> Vec> { + vec![ + Box::new(Secp256k1PrivateKey::from_u64(1).unwrap()), + Box::new(Ed25519PrivateKey::from_u64(1).unwrap()), + ] +} + +trait PrivateKey { + fn public_key(&self) -> PublicKey; + fn sign_to_signature(&self, message: Message) -> SignatureV1; + fn sign_to_signature_with_public_key(&self, message: Message) -> SignatureWithPublicKeyV1; +} + +#[allow(dead_code)] +#[derive(Clone, Copy, Debug)] +enum Message<'m> { + PlainMessage(&'m [u8]), + Hashed(&'m Hash), +} + +impl PrivateKey for Secp256k1PrivateKey { + fn sign_to_signature(&self, message: Message) -> SignatureV1 { + let data = match message { + Message::Hashed(hashed) => *hashed, + Message::PlainMessage(message) => hash(message), + }; + + let signature = self.sign(&data); + + signature.into() + } + + fn sign_to_signature_with_public_key(&self, message: Message) -> SignatureWithPublicKeyV1 { + let data = match message { + Message::Hashed(hashed) => *hashed, + Message::PlainMessage(message) => hash(message), + }; + + let signature = self.sign(&data); + + SignatureWithPublicKeyV1::Secp256k1 { signature } + } + + fn public_key(&self) -> PublicKey { + self.public_key().into() + } +} + +impl PrivateKey for Ed25519PrivateKey { + fn sign_to_signature(&self, message: Message) -> SignatureV1 { + let data = match message { + Message::Hashed(hashed) => *hashed, + Message::PlainMessage(message) => hash(message), + }; + + let signature = self.sign(&data); + + signature.into() + } + + fn sign_to_signature_with_public_key(&self, message: Message) -> SignatureWithPublicKeyV1 { + let data = match message { + Message::Hashed(hashed) => *hashed, + Message::PlainMessage(message) => hash(message), + }; + + let signature = self.sign(&data); + let public_key = self.public_key(); + + SignatureWithPublicKeyV1::Ed25519 { + public_key, + signature, + } + } + + fn public_key(&self) -> PublicKey { + self.public_key().into() + } +} diff --git a/generator/src/serializable_models/generator.rs b/generator/src/serializable_models/generator.rs new file mode 100644 index 00000000..fa79e069 --- /dev/null +++ b/generator/src/serializable_models/generator.rs @@ -0,0 +1,104 @@ +// 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 indexmap::{indexmap, IndexMap}; +use radix_engine_toolkit::models::cryptographic::public_key::{ + SerializableEd25519PublicKey, SerializablePublicKey, SerializableSecp256k1PublicKey, +}; +use radix_engine_toolkit::prelude::*; + +pub fn generate_serializable_model_examples( +) -> IndexMap<&'static str, IndexMap>> { + indexmap! { + "cryptographic/public_key" => model_examples![ + SerializablePublicKey, + SerializablePublicKeyHash, + SerializableSecp256k1PublicKey, + SerializableEd25519PublicKey, + ], + "cryptographic/signature" => model_examples![ + SerializableSignature, + SerializableSignatureWithPublicKey + ], + "cryptographic/hash" => model_examples![ + SerializableHash, + ], + "network" => model_examples![ + SerializableOlympiaNetwork, + ], + "non_fungible" => model_examples![ + SerializableNonFungibleGlobalId, + SerializableNonFungibleLocalId + ], + "node_id" => model_examples![ + SerializableNodeId, + ], + "numbers" => model_examples![ + SerializableU8 as serializable_u8, + SerializableU16 as serializable_u16, + SerializableU32 as serializable_u32, + SerializableU64 as serializable_u64, + SerializableU128 as serializable_u128, + SerializableI8 as serializable_i8, + SerializableI16 as serializable_i16, + SerializableI32 as serializable_i32, + SerializableI64 as serializable_i64, + SerializableI128 as serializable_i128, + SerializableDecimal, + SerializablePreciseDecimal, + ], + "transaction" => model_examples![ + SerializableNotarizedTransaction, + SerializableSignedIntent, + SerializableIntent, + SerializableTransactionManifest, + SerializableInstructions, + ], + "value" => model_examples![ + SerializableManifestValue + ], + "instruction" => model_examples![ + SerializableInstruction + ] + } +} + +macro_rules! model_examples { + ( + $( $function: ident $(as $name: ident)? ),* $(,)? + ) => { + { + use $crate::serializable_models::traits::HasExamples; + + let mut map = indexmap::IndexMap::new(); + + $( + #[allow(unused_variables)] + let name = $crate::utils::snake_case_type_name::<$function>(); + $( + let name = stringify!($name).to_owned(); + )? + let examples = $function::serde_value_examples().into_iter().collect::>(); + + map.insert(name, examples); + )* + + map + } + }; +} +use model_examples; diff --git a/generator/src/serializable_models/instruction.rs b/generator/src/serializable_models/instruction.rs new file mode 100644 index 00000000..8d90b936 --- /dev/null +++ b/generator/src/serializable_models/instruction.rs @@ -0,0 +1,91 @@ +// 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::traits::HasExamples; +use crate::function_examples::notarized_transaction::*; +use radix_engine_toolkit::prelude::*; +use scrypto::api::node_modules::metadata::*; +use scrypto::prelude::*; +use transaction::prelude::*; +use transaction::validation::*; + +impl<'f> HasExamples<'f> for SerializableInstruction { + fn examples() -> Vec { + ExamplesBuilder::new() + .add_instructions( + notarized_transactions() + .into_iter() + .flat_map(|item| { + item.signed_intent + .intent + .manifest + .instructions + .to_instructions(0xf2) + .unwrap() + }) + .collect::>(), + ) + .build() + } +} + +#[derive(Default)] +struct ExamplesBuilder(Vec); +impl ExamplesBuilder { + pub fn new() -> Self { + Default::default() + } + + pub fn add_instructions(self, instructions: Vec) -> Self { + self.add_serializable_instructions( + instructions + .into_iter() + .map(|instruction| { + SerializableInstruction::from_instruction( + &instruction, + 0xf2, + &mut ManifestIdAllocator::new(), + ) + .unwrap() + }) + .collect(), + ) + } + + pub fn add_serializable_instructions( + mut self, + instructions: Vec, + ) -> Self { + self.0.extend(instructions); + self + } + + pub fn build(self) -> Vec { + self.0 + .into_iter() + .collect::>() + .into_iter() + .collect() + } +} + +#[derive(NonFungibleData, ScryptoSbor, ManifestSbor)] +pub struct Human { + name: String, + age: u128, + height: (u8, u8, u8), +} diff --git a/radix-engine-toolkit/src/model/mod.rs b/generator/src/serializable_models/mod.rs similarity index 86% rename from radix-engine-toolkit/src/model/mod.rs rename to generator/src/serializable_models/mod.rs index c33a6e6c..e04f5f55 100644 --- a/radix-engine-toolkit/src/model/mod.rs +++ b/generator/src/serializable_models/mod.rs @@ -15,12 +15,14 @@ // specific language governing permissions and limitations // under the License. -pub mod address; -pub mod constants; -pub mod crypto; -pub mod engine_identifier; +pub mod generator; +pub mod traits; + +pub mod cryptographic; pub mod instruction; -pub mod resource_specifier; -pub mod runtime; +pub mod network; +pub mod node_id; +pub mod non_fungible; +pub mod numbers; pub mod transaction; pub mod value; diff --git a/cli-json-interface/src/subcommands/utils/mod.rs b/generator/src/serializable_models/network.rs similarity index 65% rename from cli-json-interface/src/subcommands/utils/mod.rs rename to generator/src/serializable_models/network.rs index fd5f65c5..2ba101b9 100644 --- a/cli-json-interface/src/subcommands/utils/mod.rs +++ b/generator/src/serializable_models/network.rs @@ -5,9 +5,9 @@ // 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 @@ -15,21 +15,20 @@ // 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), -} +use super::traits::HasExamples; +use radix_engine_toolkit::prelude::*; -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), - } +impl<'d> HasExamples<'d> for SerializableOlympiaNetwork { + fn examples() -> Vec { + vec![ + Self::Mainnet, + Self::Stokenet, + Self::Releasenet, + Self::RCNet, + Self::Milestonenet, + Self::Devopsnet, + Self::Sandpitnet, + Self::Localnet, + ] } } diff --git a/generator/src/serializable_models/node_id.rs b/generator/src/serializable_models/node_id.rs new file mode 100644 index 00000000..c8138947 --- /dev/null +++ b/generator/src/serializable_models/node_id.rs @@ -0,0 +1,61 @@ +// 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::traits::HasExamples; +use radix_engine_toolkit::prelude::*; +use scrypto::prelude::*; + +impl<'f> HasExamples<'f> for SerializableNodeId { + fn examples() -> Vec { + [ + XRD.as_node_id(), + SECP256K1_SIGNATURE_VIRTUAL_BADGE.as_node_id(), + ED25519_SIGNATURE_VIRTUAL_BADGE.as_node_id(), + PACKAGE_OF_DIRECT_CALLER_VIRTUAL_BADGE.as_node_id(), + GLOBAL_CALLER_VIRTUAL_BADGE.as_node_id(), + SYSTEM_TRANSACTION_BADGE.as_node_id(), + PACKAGE_OWNER_BADGE.as_node_id(), + VALIDATOR_OWNER_BADGE.as_node_id(), + ACCOUNT_OWNER_BADGE.as_node_id(), + IDENTITY_OWNER_BADGE.as_node_id(), + PACKAGE_PACKAGE.as_node_id(), + RESOURCE_PACKAGE.as_node_id(), + ACCOUNT_PACKAGE.as_node_id(), + IDENTITY_PACKAGE.as_node_id(), + CONSENSUS_MANAGER_PACKAGE.as_node_id(), + ACCESS_CONTROLLER_PACKAGE.as_node_id(), + POOL_PACKAGE.as_node_id(), + TRANSACTION_PROCESSOR_PACKAGE.as_node_id(), + METADATA_MODULE_PACKAGE.as_node_id(), + ROYALTY_MODULE_PACKAGE.as_node_id(), + ACCESS_RULES_MODULE_PACKAGE.as_node_id(), + GENESIS_HELPER_PACKAGE.as_node_id(), + FAUCET_PACKAGE.as_node_id(), + CONSENSUS_MANAGER.as_node_id(), + GENESIS_HELPER.as_node_id(), + FAUCET.as_node_id(), + ] + .into_iter() + .map(|node_id| { + SerializableNodeId(SerializableNodeIdInternal { + network_id: 0x01, + node_id: *node_id, + }) + }) + .collect() + } +} diff --git a/generator/src/serializable_models/non_fungible.rs b/generator/src/serializable_models/non_fungible.rs new file mode 100644 index 00000000..e30b4361 --- /dev/null +++ b/generator/src/serializable_models/non_fungible.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 std::str::FromStr; + +use radix_engine_common::prelude::{NonFungibleLocalId, ACCOUNT_OWNER_BADGE}; +use radix_engine_toolkit::prelude::*; +use transaction::prelude::NonFungibleGlobalId; + +use super::traits::HasExamples; + +impl<'d> HasExamples<'d> for SerializableNonFungibleGlobalId { + fn examples() -> Vec { + SerializableNonFungibleLocalId::examples() + .into_iter() + .map(|local_id| NonFungibleGlobalId::new(ACCOUNT_OWNER_BADGE, (*local_id).clone())) + .map(|global_id| { + SerializableNonFungibleGlobalId(SerializableNonFungibleGlobalIdInternal { + network_id: 0x01, + non_fungible_global_id: global_id, + }) + }) + .collect() + } +} + +impl<'d> HasExamples<'d> for SerializableNonFungibleLocalId { + fn examples() -> Vec { + vec![ + NonFungibleLocalId::string("Hello").unwrap(), + NonFungibleLocalId::integer(1), + NonFungibleLocalId::bytes(vec![100]).unwrap(), + NonFungibleLocalId::from_str( + "{1111111111111111-1111111111111111-1111111111111111-1111111111111111}", + ) + .unwrap(), + ] + .into_iter() + .map(SerializableNonFungibleLocalId::from) + .collect() + } +} diff --git a/generator/src/serializable_models/numbers.rs b/generator/src/serializable_models/numbers.rs new file mode 100644 index 00000000..408578a0 --- /dev/null +++ b/generator/src/serializable_models/numbers.rs @@ -0,0 +1,48 @@ +// 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::math::*; +use radix_engine_toolkit::prelude::*; + +macro_rules! impl_example { + ($type: ident) => { + impl_example!($type, $type) + }; + ($type: ident, $underlying_type: ident) => { + impl<'d> super::traits::HasExamples<'d> for $type { + fn examples() -> Vec { + vec![ + $underlying_type::MIN.into(), + (($underlying_type::MIN + $underlying_type::MAX) / 2).into(), + $underlying_type::MAX.into(), + ] + } + } + }; +} +impl_example! {SerializableU8, u8} +impl_example! {SerializableU16, u16} +impl_example! {SerializableU32, u32} +impl_example! {SerializableU64, u64} +impl_example! {SerializableU128, u128} +impl_example! {SerializableI8, i8} +impl_example! {SerializableI16, i16} +impl_example! {SerializableI32, i32} +impl_example! {SerializableI64, i64} +impl_example! {SerializableI128, i128} +impl_example! {SerializableDecimal, Decimal} +impl_example! {SerializablePreciseDecimal, PreciseDecimal} diff --git a/radix-engine-toolkit/src/model/address/mod.rs b/generator/src/serializable_models/traits.rs similarity index 69% rename from radix-engine-toolkit/src/model/address/mod.rs rename to generator/src/serializable_models/traits.rs index 6661b20c..e694a174 100644 --- a/radix-engine-toolkit/src/model/address/mod.rs +++ b/generator/src/serializable_models/traits.rs @@ -15,16 +15,18 @@ // specific language governing permissions and limitations // under the License. -pub mod coder; -pub mod entity_address; -pub mod entity_type; -pub mod network_aware_address; -pub mod non_fungible_global_id; -pub mod non_fungible_local_id; +use serde::{Deserialize, Serialize}; -pub use coder::*; -pub use entity_address::*; -pub use entity_type::*; -pub use network_aware_address::*; -pub use non_fungible_global_id::*; -pub use non_fungible_local_id::*; +pub(super) trait HasExamples<'d> +where + Self: Serialize + Deserialize<'d>, +{ + fn examples() -> Vec; + + fn serde_value_examples() -> Vec { + Self::examples() + .into_iter() + .map(|value| serde_json::to_value(value).unwrap()) + .collect() + } +} diff --git a/generator/src/serializable_models/transaction.rs b/generator/src/serializable_models/transaction.rs new file mode 100644 index 00000000..696234eb --- /dev/null +++ b/generator/src/serializable_models/transaction.rs @@ -0,0 +1,67 @@ +// 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::function_examples::notarized_transaction::notarized_transactions; +use radix_engine_toolkit::prelude::*; + +use super::traits::HasExamples; + +impl<'f> HasExamples<'f> for SerializableNotarizedTransaction { + fn examples() -> Vec { + notarized_transactions().to_vec() + } +} + +impl<'f> HasExamples<'f> for SerializableSignedIntent { + fn examples() -> Vec { + notarized_transactions() + .iter() + .cloned() + .map(|tx| tx.signed_intent) + .collect() + } +} + +impl<'f> HasExamples<'f> for SerializableIntent { + fn examples() -> Vec { + notarized_transactions() + .iter() + .cloned() + .map(|tx| tx.signed_intent.intent) + .collect() + } +} + +impl<'f> HasExamples<'f> for SerializableTransactionManifest { + fn examples() -> Vec { + notarized_transactions() + .iter() + .cloned() + .map(|tx| tx.signed_intent.intent.manifest) + .collect() + } +} + +impl<'f> HasExamples<'f> for SerializableInstructions { + fn examples() -> Vec { + notarized_transactions() + .iter() + .cloned() + .map(|tx| tx.signed_intent.intent.manifest.instructions) + .collect() + } +} diff --git a/generator/src/serializable_models/value.rs b/generator/src/serializable_models/value.rs new file mode 100644 index 00000000..5d753c85 --- /dev/null +++ b/generator/src/serializable_models/value.rs @@ -0,0 +1,199 @@ +// 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::prelude::*; +use scrypto::prelude::*; + +use super::traits::HasExamples; + +impl<'f> HasExamples<'f> for SerializableManifestValue { + fn examples() -> Vec { + vec![ + Self::Bool { value: true }, + Self::Bool { value: false }, + Self::I8 { + value: i8::MIN.into(), + }, + Self::I8 { + value: i8::MAX.into(), + }, + Self::I16 { + value: i16::MIN.into(), + }, + Self::I16 { + value: i16::MAX.into(), + }, + Self::I32 { + value: i32::MIN.into(), + }, + Self::I32 { + value: i32::MAX.into(), + }, + Self::I64 { + value: i64::MIN.into(), + }, + Self::I64 { + value: i64::MAX.into(), + }, + Self::I128 { + value: i128::MIN.into(), + }, + Self::I128 { + value: i128::MAX.into(), + }, + Self::U8 { + value: u8::MIN.into(), + }, + Self::U8 { + value: u8::MAX.into(), + }, + Self::U16 { + value: u16::MIN.into(), + }, + Self::U16 { + value: u16::MAX.into(), + }, + Self::U32 { + value: u32::MIN.into(), + }, + Self::U32 { + value: u32::MAX.into(), + }, + Self::U64 { + value: u64::MIN.into(), + }, + Self::U64 { + value: u64::MAX.into(), + }, + Self::U128 { + value: u128::MIN.into(), + }, + Self::U128 { + value: u128::MAX.into(), + }, + Self::String { + value: "Hello World".to_owned(), + }, + Self::Enum { + discriminator: 0.into(), + fields: vec![], + }, + Self::Enum { + discriminator: 0.into(), + fields: vec![ + Self::Bool { value: true }, + Self::Bool { value: false }, + Self::U8 { value: 0.into() }, + Self::String { + value: "Hello World".to_owned(), + }, + ], + }, + Self::Array { + element_value_kind: SerializableManifestValueKind::Decimal, + elements: vec![ + Self::Decimal { + value: Decimal::MIN.into(), + }, + Self::Decimal { + value: Decimal::MAX.into(), + }, + ], + }, + Self::Tuple { + fields: vec![ + Self::Bool { value: true }, + Self::Bool { value: false }, + Self::U8 { value: 0.into() }, + Self::String { + value: "Hello World".to_owned(), + }, + ], + }, + Self::Map { + key_value_kind: SerializableManifestValueKind::U8, + value_value_kind: SerializableManifestValueKind::String, + entries: vec![ + ( + Self::U8 { value: 0.into() }, + Self::String { value: "A".into() }, + ), + ( + Self::U8 { value: 1.into() }, + Self::String { value: "B".into() }, + ), + ], + }, + Self::Address { + value: SerializableManifestAddress::Static { + value: SerializableNodeId::from_global_address(RADIX_TOKEN, 0xf2), + }, + }, + Self::Address { + value: SerializableManifestAddress::Named { + value: SerializableNamedAddress::new(0), + }, + }, + Self::Bucket { + value: SerializableBucketId::new(0), + }, + Self::Proof { + value: SerializableProofId::new(0), + }, + Self::AddressReservation { + value: SerializableAddressReservation::new(0), + }, + Self::Expression { + value: SerializableExpression::EntireAuthZone, + }, + Self::Expression { + value: SerializableExpression::EntireWorktop, + }, + Self::Blob { + value: hash(b"Hello World").into(), + }, + Self::Decimal { + value: Decimal::MIN.into(), + }, + Self::Decimal { + value: Decimal::MAX.into(), + }, + Self::PreciseDecimal { + value: PreciseDecimal::MIN.into(), + }, + Self::PreciseDecimal { + value: PreciseDecimal::MAX.into(), + }, + Self::NonFungibleLocalId { + value: NonFungibleLocalId::string("Hello").unwrap().into(), + }, + Self::NonFungibleLocalId { + value: NonFungibleLocalId::integer(1).into(), + }, + Self::NonFungibleLocalId { + value: NonFungibleLocalId::bytes(vec![100]).unwrap().into(), + }, + Self::NonFungibleLocalId { + value: NonFungibleLocalId::from_str( + "{1111111111111111-1111111111111111-1111111111111111-1111111111111111}", + ) + .unwrap() + .into(), + }, + ] + } +} diff --git a/generator/src/utils.rs b/generator/src/utils.rs new file mode 100644 index 00000000..4639c7ce --- /dev/null +++ b/generator/src/utils.rs @@ -0,0 +1,247 @@ +// 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 heck::ToSnakeCase; +use indexmap::IndexMap; +use rocket_okapi::okapi::openapi3::OpenApi; +use serde_yaml::{Mapping, Value}; + +pub fn snake_case_type_name() -> String { + std::any::type_name::() + .split("::") + .last() + .unwrap() + .to_owned() + .to_snake_case() +} + +pub fn convert_open_api_adts_to_discriminated_unions(spec: &OpenApi) -> Value { + let mut spec = serde_yaml::to_value(spec).unwrap(); + + let additions_map = { + let mut map = if let Some(Value::Mapping(map)) = spec + .get_mut("components") + .and_then(|value| value.get_mut("schemas")) + { + map.iter_mut().collect::>() + } else { + panic!("Failed to find the schemas") + }; + + // Handle the discriminator changes + let mut additions_map = IndexMap::new(); + for item in map.values_mut() { + let addition_map = traverse_and_convert_discriminator(item); + additions_map.extend(addition_map) + } + additions_map + }; + + // Write the additions to the map + if let Some(Value::Mapping(map)) = spec + .get_mut("components") + .and_then(|value| value.get_mut("schemas")) + { + map.extend(additions_map) + } else { + panic!("Failed to find the schemas") + }; + + spec +} + +fn traverse_and_convert_discriminator(item: &mut Value) -> IndexMap { + if let Some(ref mut enum_variants) = get_enum(item) { + // Remove the: ["required"][enum_discriminator] and the ["properties"][enum_discriminator] + for (value, enum_property) in enum_variants.values_mut() { + // Required + if let Some(Value::Sequence(required_sequence)) = value.get_mut("required") { + if let Some(index) = + required_sequence + .iter() + .enumerate() + .find_map(|(index, value)| { + if let Value::String(string) = value { + if *string == *enum_property { + Some(index) + } else { + None + } + } else { + None + } + }) + { + required_sequence.remove(index); + } + } + + // Properties + if let Some(Value::Mapping(map)) = value.get_mut("properties") { + map.remove(Value::String(enum_property.to_string())); + } + + // Remove required if empty + let can_delete_required = value.get("required").map_or(false, |required| { + if let Value::Sequence(required) = required { + required.is_empty() + } else { + false + } + }); + if can_delete_required { + if let Value::Mapping(mapping) = value { + mapping.remove("required"); + } + } + } + + // Convert the enum variants to the required return + let enum_discriminators = enum_variants + .iter() + .map(|(k, _)| k.to_owned()) + .collect::>(); + let mut additions_map = enum_variants + .iter() + .map(|(name, (value, _))| (Value::String(name.to_string()), (*value).clone())) + .collect::>(); + + // Visit the children of the value type to see if any of them are applicable + let child_addition_maps = match item { + Value::Sequence(sequence) => sequence + .iter_mut() + .map(traverse_and_convert_discriminator) + .collect::>>(), + Value::Mapping(mapping) => mapping + .iter_mut() + .map(|(_, v)| v) + .map(traverse_and_convert_discriminator) + .collect::>>(), + Value::Tagged(tagged) => vec![traverse_and_convert_discriminator(&mut tagged.value)], + Value::Null | Value::Bool(..) | Value::Number(..) | Value::String(..) => { + Default::default() + } + }; + for child_addition_map in child_addition_maps { + additions_map.extend(child_addition_map); + } + + // Change the item to be a one-of discriminator + let item_replacement = Value::Mapping({ + let mut mapping = Mapping::new(); + + // One of key + mapping.insert( + Value::String("oneOf".to_string()), + Value::Sequence( + enum_discriminators + .iter() + .map(|enum_discriminator| { + Value::Mapping({ + let mut mapping = Mapping::new(); + + mapping.insert( + Value::String("$ref".to_string()), + Value::String(format!( + "#/components/schemas/{enum_discriminator}" + )), + ); + + mapping + }) + }) + .collect(), + ), + ); + + // Discriminator key + mapping.insert( + Value::String("discriminator".to_string()), + Value::Mapping({ + let mut mapping = Mapping::new(); + + // TODO: Property might not be `kind`. + mapping.insert( + Value::String("propertyName".to_string()), + Value::String("kind".to_string()), + ); + mapping.insert( + Value::String("mapping".to_string()), + Value::Mapping({ + let mut mapping = Mapping::new(); + + for enum_discriminator in enum_discriminators { + let key = Value::String(enum_discriminator.to_string()); + let value = Value::String(format!( + "#/components/schemas/{enum_discriminator}" + )); + mapping.insert(key, value); + } + + mapping + }), + ); + + mapping + }), + ); + + mapping + }); + *item = item_replacement; + + additions_map + } else { + Default::default() + } +} + +fn get_enum(item: &mut Value) -> Option> { + if let Value::Mapping(ref mut map) = item { + if let Some(Value::Sequence(values)) = map.get_mut("oneOf") { + let mut variants_map = IndexMap::new(); + for value in values { + // TODO: Do not rely on the `kind` key. + if let Some(Value::Sequence(enum_discriminators)) = value + .get_mut("properties") + .and_then(|value| value.get_mut("kind")) + .and_then(|value| value.get_mut("enum")) + { + if enum_discriminators.len() == 1 { + if let Some(Value::String(enum_discriminator)) = enum_discriminators.get(0) + { + variants_map + .insert(enum_discriminator.to_string(), (value, "kind".to_owned())); + } else { + return None; + } + } else { + return None; + } + } else { + return None; + } + } + + Some(variants_map) + } else { + None + } + } else { + None + } +} diff --git a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec index e27a61d0..c27062f7 100644 --- a/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec +++ b/interop/csharp/RadixDlt.RadixEngineToolkit.Native.nuspec @@ -7,7 +7,7 @@ Radix Publishing Apache-2.0 false - + Multiplatform native library that exposes a set of functions to help clients written in languages other than Rust compile and decompile transactions, perform SBOR encoding and decoding, derive virtual account and virtual badge addresses, and other functionalities. radix sbor diff --git a/native-json-interface/Cargo.toml b/native-json-interface/Cargo.toml deleted file mode 100644 index 55e570d9..00000000 --- a/native-json-interface/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "native-json-interface" -version = "0.9.0" -edition = "2021" - -[dependencies] -jni = { version = "0.20.0", default-features = false, optional = true } -radix-engine-toolkit = { path = "../radix-engine-toolkit", default-features = false } -serde = "1.0.152" -serde_json = "1.0.91" - -[dev-dependencies] -serde = { version = "1.0.144", default-features = false, features = ["serde_derive"] } -serde_json = { version = "1.0.85", default-features = false, features = ["std"] } - -wasmtime = { version = "2.0.0" } -anyhow = { version = "1.0.65" } - -[profile.release] -panic = 'abort' -codegen-units = 1 - -[lib] -name = "radix_engine_toolkit" -crate-type = ["staticlib", "cdylib"] - -[features] -default = ["jni", "radix-engine"] -jni = ["jni/default"] -radix-engine = ["radix-engine-toolkit/radix-engine"] - -[workspace] -members = [] diff --git a/native-json-interface/cbindgen.toml b/native-json-interface/cbindgen.toml deleted file mode 100644 index e28c509e..00000000 --- a/native-json-interface/cbindgen.toml +++ /dev/null @@ -1,10 +0,0 @@ -documentation = false - -[parse] -clean = true -parse_deps = true -include = ["radix-engine-toolkit"] -extra_bindings = ["radix-engine-toolkit"] - -[parse.expand] -crates = ["native-json-interface", "radix-engine-toolkit"] \ No newline at end of file diff --git a/native-json-interface/src/lib.rs b/native-json-interface/src/lib.rs deleted file mode 100644 index a1c13a7b..00000000 --- a/native-json-interface/src/lib.rs +++ /dev/null @@ -1,283 +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(clippy::missing_safety_doc)] -#![allow(non_snake_case)] - -pub mod native { - use radix_engine_toolkit::error::Result; - use radix_engine_toolkit::request::*; - use serde::{Deserialize, Serialize}; - - pub unsafe fn deserialize_from_memory<'a, T: Deserialize<'a>>( - string_pointer: radix_engine_toolkit::buffer::Pointer, - ) -> Result { - std::ffi::CStr::from_ptr(string_pointer as *const std::ffi::c_char) - .to_str() - .map_err(radix_engine_toolkit::error::Error::from) - .and_then(|string| { - serde_json::from_str(string).map_err(|error| { - radix_engine_toolkit::error::Error::InvalidRequestString { - message: format!("{:?}", error), - } - }) - }) - } - - pub unsafe fn write_serializable_to_memory( - object: &T, - ) -> Result { - serde_json::to_string(object) - .map_err( - |error| radix_engine_toolkit::error::Error::InvalidRequestString { - message: format!("{:?}", error), - }, - ) - .map(|string| { - let object_bytes = string.as_bytes(); - let byte_count = object_bytes.len() + 1; - - let pointer = radix_engine_toolkit::buffer::toolkit_alloc(byte_count); - pointer.copy_from( - [object_bytes, &[0]].concat().as_ptr() as radix_engine_toolkit::buffer::Pointer, - byte_count, - ); - - pointer - }) - } - - macro_rules! export_handler { - ($handler: ident as $handler_ident: ident) => { - #[no_mangle] - pub unsafe extern "C" fn $handler_ident( - string_pointer: radix_engine_toolkit::buffer::Pointer, - ) -> radix_engine_toolkit::buffer::Pointer { - let result_pointers = deserialize_from_memory(string_pointer) - .and_then($handler::fulfill) - .and_then(|response| write_serializable_to_memory(&response)) - .map_err(|error| { - write_serializable_to_memory(&error) - .expect("Failed to serialize error which is a trusted object") - }); - match result_pointers { - Ok(pointer) => pointer, - Err(pointer) => pointer, - } - } - }; - } - - export_handler!(InformationHandler as information); - - 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); - export_handler!(CompileNotarizedTransactionHandler as compile_notarized_transaction); - - export_handler!(DecompileTransactionIntentHandler as decompile_transaction_intent); - export_handler!(DecompileSignedTransactionIntentHandler as decompile_signed_transaction_intent); - export_handler!(DecompileNotarizedTransactionHandler as decompile_notarized_transaction); - export_handler!( - DecompileUnknownTransactionIntentHandler as decompile_unknown_transaction_intent - ); - - export_handler!( - DeriveBabylonAddressFromOlympiaAddressHandler - as derive_babylon_address_from_olympia_address - ); - export_handler!( - DeriveBabylonResourceAddressFromOlympiaResourceAddressHandler - as derive_babylon_resource_address_from_olympia_resource_address - ); - export_handler!(DeriveVirtualAccountAddressHandler as derive_virtual_account_address); - export_handler!(DeriveVirtualIdentityAddressHandler as derive_virtual_identity_address); - export_handler!( - DeriveNonFungibleGlobalIdFromPublicKeyHandler - as derive_non_fungible_global_id_from_public_key - ); - - export_handler!(EncodeAddressHandler as encode_address); - export_handler!(DecodeAddressHandler as decode_address); - - export_handler!(SborEncodeHandler as sbor_encode); - export_handler!(SborDecodeHandler as sbor_decode); - - export_handler!(KnownEntityAddressesHandler as known_entity_addresses); - export_handler!(StaticallyValidateTransactionHandler as statically_validate_transaction); - - export_handler!(HashHandler as hash); -} - -#[cfg(feature = "jni")] -pub mod jni { - use radix_engine_toolkit::error::Result; - use radix_engine_toolkit::request::*; - use serde::Serialize; - - fn serialize_to_jstring( - env: jni::JNIEnv, - object: &T, - ) -> Result { - serde_json::to_string(object) - .map_err( - |error| radix_engine_toolkit::error::Error::InvalidRequestString { - message: format!("{:?}", error), - }, - ) - .and_then(|string| { - env.new_string(&string).map_err(|error| { - radix_engine_toolkit::error::Error::InvalidRequestString { - message: format!("{:?}", error), - } - }) - }) - .map(|object| object.into_raw()) - } - - macro_rules! export_handler { - ($handler: ident as $handler_ident: ident) => { - #[no_mangle] - pub unsafe extern "system" fn $handler_ident( - env: jni::JNIEnv, - _: jni::objects::JClass, - input: jni::objects::JString, - ) -> jni::sys::jstring { - let result_strings = env - .get_string(input) - .map_err( - |error| radix_engine_toolkit::error::Error::InvalidRequestString { - message: format!("{:?}", error), - }, - ) - .and_then(|string_object| { - serde_json::from_str(&String::from(string_object)).map_err(|error| { - radix_engine_toolkit::error::Error::InvalidRequestString { - message: format!("{:?}", error), - } - }) - }) - .and_then($handler::fulfill) - .and_then(|response| serialize_to_jstring(env, &response)) - .map_err(|error| { - serialize_to_jstring(env, &error) - .expect("Failed to convert a trusted payload to jstring") - }); - - match result_strings { - Ok(string) => string, - Err(string) => string, - } - } - }; - } - - export_handler!( - InformationHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_information - ); - - export_handler!( - ConvertManifestHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_convertManifest - ); - 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 - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_compileTransactionIntent - ); - export_handler!( - CompileSignedTransactionIntentHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_compileSignedTransactionIntent - ); - export_handler!( - CompileNotarizedTransactionHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_compileNotarizedTransaction - ); - - export_handler!( - DecompileTransactionIntentHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_decompileTransactionIntent - ); - export_handler!( - DecompileSignedTransactionIntentHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_decompileSignedTransactionIntent - ); - export_handler!( - DecompileNotarizedTransactionHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_decompileNotarizedTransaction - ); - export_handler!( - DecompileUnknownTransactionIntentHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_decompileUnknownTransactionIntent - ); - - export_handler!( - DeriveBabylonAddressFromOlympiaAddressHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveBabylonAddressFromOlympiaAddress - ); - export_handler!( - DeriveBabylonResourceAddressFromOlympiaResourceAddressHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_DeriveBabylonResourceAddressFromOlympiaResourceAddress - ); - export_handler!( - DeriveVirtualAccountAddressHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveVirtualAccountAddress - ); - export_handler!( - DeriveVirtualIdentityAddressHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveVirtualIdentityAddress - ); - export_handler!(DeriveNonFungibleGlobalIdFromPublicKeyHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_deriveNonFungibleGlobalIdFromPublicKey); - - export_handler!( - EncodeAddressHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_encodeAddress - ); - export_handler!( - DecodeAddressHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_decodeAddress - ); - - export_handler!( - SborEncodeHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_sborEncode - ); - export_handler!( - SborDecodeHandler as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_sborDecode - ); - - export_handler!( - KnownEntityAddressesHandler - as Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_knownEntityAddresses - ); - export_handler!( - 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 deleted file mode 100644 index 0e87f2c7..00000000 --- a/native-json-interface/tests/toolkit_wasm_wrapper.rs +++ /dev/null @@ -1,575 +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. - -//! This module defines the struct and implementation for a [`RadixEngineToolkit`] WASM wrapper that -//! uses the WasmTime runtime. This struct is mainly defined for the purpose of testing out the -//! behavior of the Radix Engine Toolkit when it is running through a WASM host. - -use serde::de::DeserializeOwned; -use serde::Serialize; - -use std::path::{Path, PathBuf}; - -use radix_engine_toolkit::error::Error; -use radix_engine_toolkit::request::*; - -use wasmtime::{AsContextMut, Engine, Instance, Linker, Memory, Module, Store, TypedFunc}; - -// ========== -// Type Defs -// ========== - -/// A shortcut type that defines a `Result` that returns the generic `T` or a `WrapperError`. -type Result = std::result::Result; - -// ================ -// Library Wrapper -// ================ - -pub struct RadixEngineToolkit { - _engine: Engine, - _module: Module, - _linker: Linker, - store: Store, - instance: Instance, - function_store: RadixEngineToolkitFunctions, -} - -impl RadixEngineToolkit { - /// Creates a new [RadixEngineToolkit] object from a given path. - /// - /// This function is able to instantiate a new [RadixEngineToolkit] given the path to the - /// library's WASM module. This function reads the module and then creates a new object. - /// - /// # Checks - /// - /// 1. This function checks that the path provided is a valid path to an already existing file - /// - /// # Arguments - /// - /// - `path: AsRef`: A generic object which can be referenced as a `Path`. - /// - /// # Returns - /// - /// - `Result`: A new object of [RadixEngineToolkit] is returned, or a - /// [WrapperError] is returned in the case of an error. - pub fn new_from_module_path>(path: T) -> Result { - // Get the `Path` from the generic object. - let path: &Path = path.as_ref(); - - // Check that the path points to a file, if not, then return a FileNotFound error. - if !path.exists() { - return Err(WrapperError::FileNotFoundError(path.into())); - }; - - // Read the file contents and then call the bytes constructor to continue the process - let buffer: Vec = std::fs::read(path).map_err(WrapperError::FileReadingError)?; - Self::new_from_module_bytes(buffer) - } - - /// Creates a new [RadixEngineToolkit] object from a module byte array. - /// - /// This function is able to instantiate a new [RadixEngineToolkit] given the contents of the - /// WASM file. - /// - /// # Arguments - /// - /// - `bytes` [`AsRef<[u8]>`] - A generic object which can be referenced as a `[u8]`. - /// - /// # Returns - /// - /// - [`Result`]: A new object of [RadixEngineToolkit] is returned, or a - /// [WrapperError] is returned in the case of an error. - pub fn new_from_module_bytes>(bytes: T) -> Result { - // Getting the `&[u8]` from the generic object. - let bytes: &[u8] = bytes.as_ref(); - - // Creating the required WASM host objects to run the Radix Engine Toolkit WASM. - let engine: Engine = Engine::default(); - let module: Module = Module::new(&engine, bytes).map_err(WrapperError::WasmTimeError)?; - let linker: Linker = Linker::new(&engine); - let mut store: Store = Store::new(&engine, 4); - let instance: Instance = linker - .instantiate(&mut store, &module) - .map_err(WrapperError::WasmTimeError)?; - let function_store: RadixEngineToolkitFunctions = - RadixEngineToolkitFunctions::new(&instance, &mut store)?; - - let radix_engine_toolkit: Self = Self { - _engine: engine, - _module: module, - _linker: linker, - store, - instance, - function_store, - }; - Ok(radix_engine_toolkit) - } - - /// Creates a new [RadixEngineToolkit] object from source code. - /// - /// This function compiles the [RadixEngineToolkit] as to a `wasm32-unknown-unknown` target and - /// then uses the `new_from_module_path` constructor to create a new [RadixEngineToolkit] object - /// - /// # Returns - /// - /// - [`Result`]: A new object of [RadixEngineToolkit] is returned, or a - /// [`WrapperError`] - pub fn new_compile_from_source() -> Result { - // The path to the directory containing the Cargo.toml manifest file - let manifest_directory: PathBuf = - std::env::current_dir().expect("Failed to get the path of the current directory"); - - // Build the Radix Engine Toolkit from source - Build a wasm32-unknown-unknown binary for - // release. - let status: std::process::ExitStatus = std::process::Command::new("cargo") - .current_dir(&manifest_directory) - .args([ - "build", - "--target", - "wasm32-unknown-unknown", - "--release", - "--no-default-features", - ]) - .status() - .expect("Compilation of WASM for tests failed"); - if !status.success() { - panic!("Failed to compile package: {:?}", &manifest_directory); - }; - - // Building a path to the WASM file - let wasm_module_path: PathBuf = manifest_directory - .join("target/wasm32-unknown-unknown/release/radix_engine_toolkit.wasm"); - Self::new_from_module_path(wasm_module_path) - } - - crate::define_request_function! {InformationRequest, InformationResponse, information} - crate::define_request_function! {ConvertManifestRequest, ConvertManifestResponse, convert_manifest} - crate::define_request_function! {CompileTransactionIntentRequest, CompileTransactionIntentResponse, compile_transaction_intent} - crate::define_request_function! {DecompileTransactionIntentRequest, DecompileTransactionIntentResponse, decompile_transaction_intent} - crate::define_request_function! {CompileSignedTransactionIntentRequest, CompileSignedTransactionIntentResponse, compile_signed_transaction_intent} - crate::define_request_function! {DecompileSignedTransactionIntentRequest, DecompileSignedTransactionIntentResponse, decompile_signed_transaction_intent} - crate::define_request_function! {CompileNotarizedTransactionRequest, CompileNotarizedTransactionResponse, compile_notarized_transaction} - crate::define_request_function! {DecompileNotarizedTransactionRequest, DecompileNotarizedTransactionResponse, decompile_notarized_transaction} - crate::define_request_function! {DecompileUnknownTransactionIntentRequest, DecompileUnknownTransactionIntentResponse, decompile_unknown_transaction_intent} - crate::define_request_function! {DecodeAddressRequest, DecodeAddressResponse, decode_address} - crate::define_request_function! {EncodeAddressRequest, EncodeAddressResponse, encode_address} - crate::define_request_function! {SborDecodeRequest, SborDecodeResponse, sbor_decode} - crate::define_request_function! {SborEncodeRequest, SborEncodeResponse, sbor_encode} - crate::define_request_function! {DeriveVirtualAccountAddressRequest, DeriveVirtualAccountAddressResponse, derive_virtual_account_address} - - /// Calls a function in the WASM instance with a given request - /// - /// This is a high level method which is used to call functions in the WASM instance while - /// abstracting away the memory allocation, serialization, writing of objects, and all of the - /// other steps. This can be thought of as the main router which all requests to the transaction - /// library go through. - /// - /// At a high level, this function does the following: - /// - /// 1. Serializes the request. - /// 2. Allocates enough memory for the C-String representation of the serialized request. - /// 3. Writes this request to linear memory. - /// 4. Invokes the WASM function. - /// 5. Reads the response string at the pointer returned by the WASM function - /// 6. Attempts to deserialize the response as `D`. If that fails, then the response is assumed - /// to be an [Error] response and therefore it attempts to deserialize it as such. - /// 7. Frees up the memory allocated for the request and the response strings. - /// 8. Returns the deserialized object. - /// - /// # Arguments - /// - /// - `function` [TypedFunc] - The function to invoke on the WASM instance. This - /// function should take an [i32] and return an [i32]. By default, the arguments and the returns - /// are the memory offsets of the request and the response respectively in the WASM's linear - /// memory. - /// - `request`: [Serialize]: A generic object that implements serde's [Serialize] trait and - /// therefore can be serialized to a string. This is the request payload that the `function` - /// will be called with. - /// - /// # Returns - /// - /// - `Result>`: This method has a complex return type mainly due - /// to the nature - fn call_wasm_function( - &mut self, - function: TypedFunc, - request: S, - ) -> Result { - // Write the request to the WASM's linear memory - let request_memory_offset: i32 = self.write_object_to_memory(request)?; - - // Call the function using the provided request memory offset - let response_memory_offset: i32 = function - .call(&mut self.store, request_memory_offset) - .map_err(WrapperError::WasmTimeTrapError)?; - - // The response is either of type `D` or of type `Error`. So, we attempt to decode it as - // both - let response_string: String = self.read_string(response_memory_offset)?; - let response: Result = if let Ok(response) = Self::deserialize::(&response_string) - { - Ok(response) - } else if let Ok(response) = Self::deserialize::(&response_string) { - Err(WrapperError::LibraryError(response)) - } else { - return Err(WrapperError::DeserializationError); - }; - - // Free up the allocated memory for the request and the response - self.free_memory(request_memory_offset)?; - self.free_memory(response_memory_offset)?; - - response - } - - /// Writes an object to linear memory - /// - /// This is a higher level method used to serialize, allocate memory, and eventually write an - /// object to the WASM's linear memory. This method returns of the offset at which the C-String - /// UTF-8 encoded representation of the serialized object is stored. - /// - /// # Arguments - /// - /// - `object: Serialize`: A generic object which implements the [Serialize] trait and therefore - /// can be serialized using serde. - /// - /// # Returns - /// - /// - `Result`: An [i32] is returned if the memory allocation is successful, otherwise, a - /// [WrapperError] is returned. - fn write_object_to_memory(&mut self, object: S) -> Result { - let serialized_object: String = Self::serialize(object); - let memory_offset: i32 = self.allocate_memory_for_string(&serialized_object)?; - self.write_string(serialized_object, memory_offset)?; - Ok(memory_offset) - } - - /// Serializes an object to a JSON string - /// - /// # Arguments - /// - /// - `object` [`Serialize`] - A generic object of any type that implements the [Serialize] - /// trait. - /// - /// # Returns - /// - /// - [`String`]: A JSON string of the serialized object - fn serialize(object: S) -> String { - serde_json::to_string(&object).expect("Could not serialize a trusted payload") - } - - /// Deserializes an object from JSON string to the generic `D`. - /// - /// This is a generic function capable of deserializing any input string to type specified by - /// the generic `D`. - /// - /// # Arguments - /// - /// - `string: AsRef>`: Any object which can implements the `AsRef` trait. - /// - /// # Returns - /// - /// - `Result`: A result response containing an object of type `D` if the deserialization - /// succeeded. - fn deserialize>(string: S) -> Result { - let str: &str = string.as_ref(); - serde_json::from_str(str).map_err(|error| { - WrapperError::RadixEngineToolkitError(Error::InvalidRequestString { - message: format!("{:?}", error), - }) - }) - } - - /// Writes a string to the WASM's linear memory. - /// - /// This function, takes a string to writes its C-String representation to linear memory at the - /// specified memory offset to write the string at. - /// - /// # Arguments - /// - /// - `string: AsRef`: Any object which can implements the `AsRef` trait. - /// - `memory_offset: i32`: An `i32` of the memory offset to write the string at. - /// - /// # Returns - /// - /// - `Result<()>`: A result is returned of either unit in the case of successful writing, or - /// a [WrapperError] in the case of the string writing failing. - /// - /// # Note - /// - /// It is assumed that memory offset value is obtained through a call to the `allocate_memory` - /// function on this class. - fn write_string>(&mut self, string: S, memory_offset: i32) -> Result<()> { - // Converting the string to a C String and writing - let string: &str = string.as_ref(); - let mut string_bytes: Vec = string.as_bytes().to_vec(); - string_bytes.push(0); - - self.get_memory() - .write(&mut self.store, memory_offset as usize, &string_bytes) - .map_err(WrapperError::MemoryAccessError)?; - Ok(()) - } - - /// Reads a C-String from the given memory offset. - /// - /// This function takes a memory offset and reads a null terminated UTF-8 encoded string - /// beginning from this memory offset. - /// - /// # Arguments - /// - /// - `memory_offset: i32`: A memory offset where the string is stored in the instance's linear - /// memory - /// - /// # Returns: - /// - /// `Result`: If the reading is successful, then a [String] is returned, otherwise, a - /// [WrapperError] is returned. - fn read_string(&mut self, memory_offset: i32) -> Result { - // Creating a memory buffer containing the memory contents beginning from the specified - // memory offset. - let memory_buffer: &[u8] = &self.get_memory().data(&self.store)[memory_offset as usize..]; - - // Getting the index of the first null offset. - if let Some(null_index) = memory_buffer.iter().position(|x| *x == 0) { - let string_buffer: &[u8] = &memory_buffer[..null_index]; - Ok(String::from( - std::str::from_utf8(string_buffer).map_err(WrapperError::Utf8Error)?, - )) - } else { - Err(WrapperError::NullTerminatorNotFound) - } - } - - /// Allocates memory for a string in the instance's linear memory - /// - /// This method takes a string and allocates enough memory for its C-String UTF-8 encoded - /// representation in the instance's linear memory. - /// - /// # Arguments - /// - /// - `string: AsRef`: A generic object which can be referenced as a `str`. - /// - /// # Returns - /// - /// - [`Result`]: An [i32] is returned if the memory allocation is successful, otherwise, a - /// [WrapperError] is returned. - fn allocate_memory_for_string>(&mut self, string: S) -> Result { - // Converting the string to a C-String and getting the byte count of this string - let string: &str = string.as_ref(); - let byte_count: usize = string.len(); - - // Memory allocation by capacity can now be performed. - self.allocate_memory_by_capacity(byte_count + 1) - } - - /// Allocates memory in the instance's linear memory - /// - /// This method takes a string and allocates memory in the instance's linear memory based on the - /// capacity required. - /// - /// # Arguments - /// - /// - `capacity: usize`: The byte count of the amount of bytes to allocate. - /// - /// # Returns - /// - /// - [Result]: An [i32] is returned if the memory allocation is successful, otherwise, a - /// [WrapperError] is returned. - fn allocate_memory_by_capacity(&mut self, capacity: usize) -> Result { - self.function_store - .toolkit_alloc - .call(&mut self.store, capacity as i32) - .map_err(WrapperError::WasmTimeTrapError) - } - - /// Frees up memory in the WASM's linear memory. - /// - /// This method frees up memory in WASM's linear memory. This is with the assumption that the - /// memory was allocated through the library's memory allocator - fn free_memory(&mut self, memory_offset: i32) -> Result<()> { - self.function_store - .toolkit_free_c_string - .call(&mut self.store, memory_offset) - .map_err(WrapperError::WasmTimeTrapError) - } - - /// Gets the memory of the current WASM instance. - /// - /// # Returns - /// - /// - [Memory]: A memory object of instance's linear memory. - fn get_memory(&mut self) -> Memory { - self.instance - .get_memory(&mut self.store, "memory") - .expect("Failed to get the memory of the WASM instance") - } -} - -// =============== -// Function Store -// =============== - -crate::define_function_store! { - pub struct RadixEngineToolkitFunctions { - pub information: TypedFunc, - - pub convert_manifest: TypedFunc, - - pub compile_transaction_intent: TypedFunc, - pub compile_signed_transaction_intent: TypedFunc, - pub compile_notarized_transaction: TypedFunc, - - pub decompile_transaction_intent: TypedFunc, - pub decompile_signed_transaction_intent: TypedFunc, - pub decompile_notarized_transaction: TypedFunc, - pub decompile_unknown_transaction_intent: TypedFunc, - - pub sbor_encode: TypedFunc, - pub sbor_decode: TypedFunc, - - pub encode_address: TypedFunc, - pub decode_address: TypedFunc, - - pub derive_virtual_account_address: TypedFunc, - - pub toolkit_alloc: TypedFunc, - pub toolkit_free_c_string: TypedFunc - } -} - -// ====== -// Error -// ====== - -/// An enum representing errors encountered by the [RadixEngineToolkit] wrapper. -#[derive(Debug)] -pub enum WrapperError { - /// An error emitted when a file could not be found. - FileNotFoundError(PathBuf), - - /// An error emitted when a file could not be read. - FileReadingError(std::io::Error), - - /// An error emitted by the WasmTime runtime. - WasmTimeError(anyhow::Error), - - /// An error emitted when a Radix Engine Toolkit operation fails - RadixEngineToolkitError(Error), - - /// An error emitted when trying to access the linear memory of a WASM instance. - MemoryAccessError(wasmtime::MemoryAccessError), - - /// An error emitted when no null terminator can be found. - NullTerminatorNotFound, - - /// An error representing the standard library's [std::str::Utf8Error] type. - Utf8Error(std::str::Utf8Error), - - /// An error representing the standard library's [std::ffi::NulError] type. - NulError(std::ffi::NulError), - - /// An error representing the standard library's [wasmtime::Trap] type. - WasmTimeTrapError(wasmtime::Trap), - - /// An error emitted when the deserialization of an object fails - DeserializationError, - - /// An error emitted during runtime in response to a request - LibraryError(Error), -} - -impl From for WrapperError { - fn from(error: std::ffi::NulError) -> Self { - Self::NulError(error) - } -} - -impl From for WrapperError { - fn from(error: anyhow::Error) -> Self { - Self::WasmTimeError(error) - } -} - -// ======= -// Macros -// ======= - -#[macro_export] -macro_rules! define_function_store{ - ( - $vis:vis struct $struct_name:ident { - $( - $field_vis:vis $field_name:ident : TypedFunc<$input_type: ty, $output_type: ty> - ),* - } - ) => { - $vis struct $struct_name{ - $( - $field_vis $field_name : TypedFunc<$input_type, $output_type>, - )* - } - - impl $struct_name { - pub fn new(instance: &Instance, store: &mut Store) -> Result { - Ok( - Self { - $( - $field_name: instance.get_typed_func(store.as_context_mut(), stringify!($field_name))?, - )* - } - ) - } - } - } -} - -#[macro_export] -macro_rules! define_request_function { - ($request_type: ty, $response_type: ty, $function_ident: ident) => { - pub fn $function_ident(&mut self, request: $request_type) -> Result<$response_type> { - self.call_wasm_function(self.function_store.$function_ident, request) - } - }; -} - -// ====== -// Tests -// ====== - -#[cfg(test)] -mod tests { - use radix_engine_toolkit::request::{InformationRequest, InformationResponse}; - - use super::{RadixEngineToolkit, Result}; - - #[test] - pub fn test_information_request_succeeds() { - // Arrange - let mut radix_engine_toolkit: RadixEngineToolkit = - RadixEngineToolkit::new_compile_from_source() - .expect("Failed to create a new library from source"); - - // Act - let response: Result = - radix_engine_toolkit.information(InformationRequest {}); - - // Assert - assert!(matches!(response, Ok(_))) - } -} diff --git a/prep.sh b/prep.sh new file mode 100755 index 00000000..c757fab8 --- /dev/null +++ b/prep.sh @@ -0,0 +1,8 @@ +BASEDIR=$(dirname "$0") +cd $BASEDIR + +python3 add_license.py +./format.sh +./test.sh +./uniffi_bindgen.sh +(cd generator; cargo run) \ No newline at end of file diff --git a/radix-engine-toolkit-core/Cargo.toml b/radix-engine-toolkit-core/Cargo.toml new file mode 100644 index 00000000..bdae660c --- /dev/null +++ b/radix-engine-toolkit-core/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "radix-engine-toolkit-core" +version = "0.10.0-elm.1" +edition = "2021" +build = "build.rs" + +[dependencies] +# radixdlt-scrypto dependencies. +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e" } +radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", default-features= false, features = ["std", "lru"] } +radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +radix-engine-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e" } +radix-engine-queries = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", default-features= false, features = ["std", "lru"] } +radix-engine-store-interface = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e" } + +# Bech32 encoding and decoding of addresses. Used for the Olympia <-> Babylon address derivations. +bech32 = { version = "0.9.1" } + +# The serde-json dependency without the serde dependency. This is used for the SBOR serialization +# in the `scrypto_sbor.rs` and `manifest_sbor.rs` modules and ONLY there. +serde_json = { version = "1.0.96", features = ["preserve_order"] } + +# Used by the Radix Engine Toolkit to cashe the result of some operations that should only be +# computed once. +lazy_static = { version = "1.4.0" } +regex = "1.8.4" + +[build-dependencies] +cargo_toml = { version = "0.15.3" } + +[dev-dependencies] +scrypto-unit = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", default-features = false, features = ["lru", "std", "resource_tracker"] } + +[lib] +crate-type = ["staticlib", "cdylib", "rlib"] diff --git a/radix-engine-toolkit-core/build.rs b/radix-engine-toolkit-core/build.rs new file mode 100644 index 00000000..da8f39a7 --- /dev/null +++ b/radix-engine-toolkit-core/build.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 cargo_toml::{Dependency, Manifest}; +use std::env; +use std::path::Path; + +fn main() { + let manifest_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml"); + let manifest = Manifest::from_path(manifest_path).unwrap(); + + let scrypto_dependency = manifest.dependencies.get("scrypto").unwrap(); + let string = match scrypto_dependency { + Dependency::Simple(version) => format!("version={version}"), + Dependency::Inherited(_) => panic!("Inherited dependency is not supported"), + Dependency::Detailed(detailed) => { + if let Some(ref version) = detailed.version { + format!("version={version}") + } else if let Some(ref branch) = detailed.branch { + format!("branch={branch}") + } else if let Some(ref tag) = detailed.tag { + format!("tag={tag}") + } else if let Some(ref rev) = detailed.rev { + format!("rev={rev}") + } else { + panic!("Can't find version of Scrypto dependency") + } + } + }; + println!("cargo:rustc-env=SCRYPTO_DEPENDENCY={}", string); +} diff --git a/radix-engine-toolkit-core/rustfmt.toml b/radix-engine-toolkit-core/rustfmt.toml new file mode 100644 index 00000000..a735b984 --- /dev/null +++ b/radix-engine-toolkit-core/rustfmt.toml @@ -0,0 +1,3 @@ +unstable_features = true +wrap_comments = true +comment_width = 100 \ No newline at end of file diff --git a/radix-engine-toolkit-core/src/functions/derive.rs b/radix-engine-toolkit-core/src/functions/derive.rs new file mode 100644 index 00000000..c6b1e873 --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/derive.rs @@ -0,0 +1,236 @@ +// 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 bech32::{FromBase32, ToBase32}; +use scrypto::prelude::*; + +use crate::utils; + +pub fn virtual_account_address_from_public_key

(public_key: &P) -> ComponentAddress +where + P: Into + Clone, +{ + ComponentAddress::virtual_account_from_public_key(public_key) +} + +pub fn virtual_identity_address_from_public_key

(public_key: &P) -> ComponentAddress +where + P: Into + Clone, +{ + ComponentAddress::virtual_identity_from_public_key(public_key) +} + +pub fn virtual_signature_non_fungible_global_id_from_public_key

( + public_key: &P, +) -> NonFungibleGlobalId +where + P: HasPublicKeyHash, +{ + NonFungibleGlobalId::from_public_key(public_key) +} + +pub fn virtual_account_address_from_olympia_account_address( + olympia_account_address: S, +) -> Result +where + S: AsRef, +{ + public_key_from_olympia_account_address(olympia_account_address) + .map(|public_key| virtual_account_address_from_public_key(&public_key)) +} + +pub fn resource_address_from_olympia_resource_address( + olympia_resource_address: S, +) -> Result +where + S: AsRef, +{ + let olympia_resource_address = olympia_resource_address.as_ref(); + let (_, data, variant) = + bech32::decode(olympia_resource_address).map_err(DerivationError::Bech32DecodeError)?; + if let bech32::Variant::Bech32 = variant { + Ok(()) + } else { + Err(DerivationError::InvalidOlympiaBech32Variant { + expected: bech32::Variant::Bech32, + actual: bech32::Variant::Bech32m, + }) + }?; + + // Convert from 5 bits to 8 bits. + let data = Vec::::from_base32(&data).map_err(DerivationError::Bech32BaseConversionError)?; + + // Check the length of the data to ensure that it's valid. + let prefix = data.first(); + let length = data.len(); + + let node_id = match (prefix, length) { + (Some(0x01), 1) => Ok(scrypto::prelude::RADIX_TOKEN.into_node_id()), + (Some(0x03), 27) => { + let hash = scrypto::prelude::hash(&data); + + let mut bytes = vec![EntityType::GlobalFungibleResourceManager as u8]; + bytes.extend(hash.0[..29].iter()); + + Ok(NodeId(bytes.try_into().unwrap())) + } + _ => Err(DerivationError::InvalidOlympiaAddressLength { + expected: 27, + actual: length, + }), + }?; + + Ok(ResourceAddress::new_or_panic(node_id.0)) +} + +pub fn public_key_from_olympia_account_address( + olympia_account_address: S, +) -> Result +where + S: AsRef, +{ + let olympia_account_address = olympia_account_address.as_ref(); + + // Ensure that the second and third characters in the string are d and x which are present in + // all account HRPs in Olympia regardless of the network. + match ( + olympia_account_address.chars().nth(1), + olympia_account_address.chars().nth(2), + ) { + (Some('d'), Some('x')) => Ok(()), + (Some(char1), Some(char2)) => Err( + DerivationError::InvalidCharsInOlympiaAddressEntitySpecifier { + expected: ('d', 'x'), + actual: (char1, char2), + }, + ), + _ => Err(DerivationError::InvalidOlympiaAddressLength { + expected: 65, + actual: olympia_account_address.len(), + }), + }?; + + let (_, data, variant) = + bech32::decode(olympia_account_address).map_err(DerivationError::Bech32DecodeError)?; + if let bech32::Variant::Bech32 = variant { + Ok(()) + } else { + Err(DerivationError::InvalidOlympiaBech32Variant { + expected: bech32::Variant::Bech32, + actual: bech32::Variant::Bech32m, + }) + }?; + + let mut data = + Vec::::from_base32(&data).map_err(DerivationError::Bech32BaseConversionError)?; + + // 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 { + Err(DerivationError::InvalidOlympiaAddressLength { + expected: 34, + actual: data.len(), + }) + } else if *data.first().unwrap() != 0x04 { + Err(DerivationError::InvalidOlympiaAddressPrefix { + expected: 0x04, + actual: *data.first().unwrap(), + }) + } else { + data.remove(0); + Ok(()) + }?; + + let public_key = + Secp256k1PublicKey(data.try_into().expect("Impossible case. Length is known.")); + + Ok(public_key) +} + +pub fn olympia_account_address_from_public_key( + public_key: &Secp256k1PublicKey, + olympia_network: OlympiaNetwork, +) -> String { + let public_key = { + let mut vector = vec![0x04]; + vector.extend(public_key.0); + vector + }; + bech32::encode( + olympia_network.hrp(), + public_key.to_base32(), + bech32::Variant::Bech32, + ) + .unwrap() +} + +pub fn node_address_from_public_key(public_key: &Secp256k1PublicKey, network_id: u8) -> String { + let hrp = { + let network_identifier = utils::network_definition_from_network_id(network_id).hrp_suffix; + format!("node_{network_identifier}") + }; + + bech32::encode(&hrp, public_key.0.to_base32(), bech32::Variant::Bech32m).unwrap() +} + +pub enum OlympiaNetwork { + Mainnet, + Stokenet, + Releasenet, + RCNet, + Milestonenet, + Devopsnet, + Sandpitnet, + Localnet, +} + +impl OlympiaNetwork { + pub const fn hrp(&self) -> &str { + match self { + Self::Mainnet => "rdx", + Self::Stokenet => "tdx", + Self::Releasenet => "tdx3", + Self::RCNet => "tdx4", + Self::Milestonenet => "tdx5", + Self::Devopsnet => "tdx6", + Self::Sandpitnet => "tdx7", + Self::Localnet => "ddx", + } + } +} + +#[derive(Debug)] +pub enum DerivationError { + InvalidCharsInOlympiaAddressEntitySpecifier { + expected: (char, char), + actual: (char, char), + }, + InvalidOlympiaAddressLength { + expected: usize, + actual: usize, + }, + InvalidOlympiaBech32Variant { + expected: bech32::Variant, + actual: bech32::Variant, + }, + InvalidOlympiaAddressPrefix { + expected: u8, + actual: u8, + }, + Bech32DecodeError(bech32::Error), + Bech32BaseConversionError(bech32::Error), +} diff --git a/radix-engine-toolkit-core/src/functions/execution.rs b/radix-engine-toolkit-core/src/functions/execution.rs new file mode 100644 index 00000000..3d2e41df --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/execution.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 radix_engine::system::system_modules::execution_trace::*; +use radix_engine::transaction::*; +use scrypto::api::node_modules::metadata::*; +use scrypto::prelude::*; +use transaction::prelude::*; + +use crate::instruction_visitor::core::error::*; +use crate::instruction_visitor::core::traverser::*; +use crate::instruction_visitor::visitors::account_proofs_visitor::*; +use crate::instruction_visitor::visitors::transaction_type::general_transaction_visitor::*; +use crate::instruction_visitor::visitors::transaction_type::simple_transfer_visitor::*; +use crate::instruction_visitor::visitors::transaction_type::transfer_visitor::*; +use crate::utils; + +pub fn analyze( + instructions: &[InstructionV1], + preview_receipt: &TransactionReceipt, +) -> Result { + let (execution_trace, fee_summary) = match preview_receipt.transaction_result { + TransactionResult::Commit(CommitResult { + outcome: TransactionOutcome::Success(..), + ref execution_trace, + ref fee_summary, + .. + }) => Ok((execution_trace, fee_summary)), + _ => Err(ExecutionModuleError::IsNotCommitSuccess( + preview_receipt.clone(), + )), + }?; + + let mut account_proofs_visitor = AccountProofsVisitor::default(); + let mut simple_transfer_visitor = SimpleTransactionTypeVisitor::default(); + let mut transfer_visitor = TransferTransactionTypeVisitor::default(); + let mut general_transaction_visitor = GeneralTransactionTypeVisitor::new(execution_trace); + + traverse( + instructions, + &mut [ + &mut simple_transfer_visitor, + &mut transfer_visitor, + &mut account_proofs_visitor, + &mut general_transaction_visitor, + ], + )?; + + let transaction_type = if let Some((from_account_address, to_account_address, transfer)) = + simple_transfer_visitor.output() + { + TransactionType::SimpleTransfer(Box::new(SimpleTransferTransactionType { + from: from_account_address, + to: to_account_address, + transferred: transfer, + })) + } else if let Some((from_account_address, transfers)) = transfer_visitor.output() { + TransactionType::Transfer(Box::new(TransferTransactionType { + from: from_account_address, + transfers, + })) + } else if let Some((account_withdraws, account_deposits)) = general_transaction_visitor.output() + { + TransactionType::GeneralTransaction(Box::new(GeneralTransactionType { + account_proofs: account_proofs_visitor.output(), + account_withdraws, + account_deposits, + addresses_in_manifest: crate::functions::instructions::extract_addresses(instructions), + metadata_of_newly_created_entities: utils::metadata_of_newly_created_entities( + preview_receipt, + ) + .unwrap(), + data_of_newly_minted_non_fungibles: utils::data_of_newly_minted_non_fungibles( + preview_receipt, + ) + .unwrap(), + })) + } else { + TransactionType::NonConforming + }; + + let mut fee_locks = FeeLocks::default(); + for (_, amount, is_contingent) in fee_summary.locked_fees.iter() { + let amount = amount.amount(); + if *is_contingent { + fee_locks.contingent_lock += amount; + } else { + fee_locks.lock += amount; + } + } + + let fee_summary = { + // Previews sometimes reports a cost unit price of zero. So, we will: + // * Calculate all fees in XRD from the cost units. + // * Calculate all fees based on the current cost unit price. + let mut network_fees = 0u128; + for value in fee_summary.execution_cost_breakdown.values() { + network_fees += *value as u128; + } + let network_fee = cost_units_to_xrd(network_fees); + + let royalty_fee = fee_summary + .royalty_cost_breakdown + .values() + .map(|(_, v)| *v) + .sum(); + + FeeSummary { + network_fee, + royalty_fee, + } + }; + + Ok(ExecutionAnalysis { + fee_locks, + fee_summary, + transaction_type, + }) +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct ExecutionAnalysis { + pub fee_locks: FeeLocks, + pub fee_summary: FeeSummary, + pub transaction_type: TransactionType, +} + +#[derive(Clone, Debug, PartialEq, Eq, Default)] +pub struct FeeSummary { + pub network_fee: Decimal, + pub royalty_fee: Decimal, +} + +#[derive(Clone, Debug, PartialEq, Eq, Default)] +pub struct FeeLocks { + pub lock: Decimal, + pub contingent_lock: Decimal, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum TransactionType { + SimpleTransfer(Box), + Transfer(Box), + GeneralTransaction(Box), + NonConforming, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct SimpleTransferTransactionType { + pub from: ComponentAddress, + pub to: ComponentAddress, + pub transferred: ResourceSpecifier, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct TransferTransactionType { + pub from: ComponentAddress, + pub transfers: HashMap>, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct GeneralTransactionType { + pub account_proofs: HashSet, + pub account_withdraws: HashMap>, + pub account_deposits: HashMap>>, + pub addresses_in_manifest: (HashSet, HashSet), + pub metadata_of_newly_created_entities: HashMap>, + pub data_of_newly_minted_non_fungibles: + HashMap>, +} + +#[derive(Clone, Debug)] +pub enum ExecutionModuleError { + IsNotCommitSuccess(TransactionReceipt), + InstructionVisitorError(InstructionVisitorError), + LocatedGeneralTransactionTypeError(LocatedGeneralTransactionTypeError), +} + +impl From for ExecutionModuleError { + fn from(value: InstructionVisitorError) -> Self { + Self::InstructionVisitorError(value) + } +} + +fn cost_units_to_xrd(cost_units: u128) -> Decimal { + Decimal::from_str(DEFAULT_COST_UNIT_PRICE_IN_XRD).unwrap() * cost_units +} diff --git a/radix-engine-toolkit-core/src/functions/information.rs b/radix-engine-toolkit-core/src/functions/information.rs new file mode 100644 index 00000000..c19cbbca --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/information.rs @@ -0,0 +1,61 @@ +// 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 fn information() -> BuildInformation { + let version = env!("CARGO_PKG_VERSION").into(); + let scrypto_dependency = DependencyInformation::from_environment_variable(); + + BuildInformation { + version, + scrypto_dependency, + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct BuildInformation { + pub version: String, + pub scrypto_dependency: DependencyInformation, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum DependencyInformation { + // Crates.io + Version(String), + + // Github + Tag(String), + Branch(String), + Rev(String), +} + +impl DependencyInformation { + fn from_environment_variable() -> Self { + let version = env!("SCRYPTO_DEPENDENCY"); + + let mut splitted = version.split('='); + let identifier = splitted.next().unwrap(); + let value = splitted.next().unwrap(); + + match identifier { + "version" => Self::Version(value.into()), + "tag" => Self::Tag(value.into()), + "branch" => Self::Branch(value.into()), + "rev" => Self::Rev(value.into()), + _ => panic!("Unknown identifier encountered: {}", identifier), + } + } +} diff --git a/radix-engine-toolkit-core/src/functions/instructions.rs b/radix-engine-toolkit-core/src/functions/instructions.rs new file mode 100644 index 00000000..af4c2aac --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/instructions.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 radix_engine::utils::*; +use sbor::*; +use scrypto::prelude::*; +use transaction::errors::*; +use transaction::prelude::*; +use transaction::validation::*; + +use crate::instruction_visitor::core::traverser::traverse; +use crate::instruction_visitor::visitors::account_interactions_visitor::*; +use crate::instruction_visitor::visitors::identity_interactions_visitor::IdentityInteractionsVisitor; +use crate::sbor::indexed_manifest_value::*; + +pub fn hash(instructions: &[InstructionV1]) -> Result { + compile(instructions).map(scrypto::prelude::hash) +} + +pub fn compile(instructions: &[InstructionV1]) -> Result, EncodeError> { + manifest_encode(instructions) +} + +pub fn decompile(payload_bytes: T) -> Result, DecodeError> +where + T: AsRef<[u8]>, +{ + manifest_decode(payload_bytes.as_ref()) +} + +pub fn statically_validate( + instructions: &[InstructionV1], +) -> Result<(), InstructionValidationError> { + radix_engine::utils::validate_call_arguments_to_native_components(instructions) + .map_err(InstructionValidationError::LocatedInstructionSchemaValidationError)?; + NotarizedTransactionValidator::validate_instructions_v1(instructions) + .map_err(InstructionValidationError::TransactionValidationError)?; + Ok(()) +} + +pub fn extract_addresses(instructions: &[InstructionV1]) -> (HashSet, HashSet) { + let indexed_manifest_value = IndexedManifestValue::from_typed(instructions); + + ( + indexed_manifest_value + .static_addresses() + .iter() + .cloned() + .collect(), + indexed_manifest_value + .named_addresses() + .iter() + .cloned() + .collect(), + ) +} + +pub fn identities_requiring_auth(instructions: &[InstructionV1]) -> HashSet { + let mut visitor = IdentityInteractionsVisitor::default(); + traverse(instructions, &mut [&mut visitor]).expect("This visitor can't fail"); + visitor.output() +} + +pub fn accounts_requiring_auth(instructions: &[InstructionV1]) -> HashSet { + let mut visitor = AccountInteractionsVisitor::default(); + traverse(instructions, &mut [&mut visitor]).expect("This visitor can't fail"); + let (accounts_requiring_auth, _, _) = visitor.output(); + accounts_requiring_auth +} + +pub fn accounts_withdrawn_from(instructions: &[InstructionV1]) -> HashSet { + let mut visitor = AccountInteractionsVisitor::default(); + traverse(instructions, &mut [&mut visitor]).expect("This visitor can't fail"); + let (_, accounts_withdrawn_from, _) = visitor.output(); + accounts_withdrawn_from +} + +pub fn accounts_deposited_into(instructions: &[InstructionV1]) -> HashSet { + let mut visitor = AccountInteractionsVisitor::default(); + traverse(instructions, &mut [&mut visitor]).expect("This visitor can't fail"); + let (_, _, accounts_deposited_into) = visitor.output(); + accounts_deposited_into +} + +#[derive(Clone, Debug)] +pub enum InstructionValidationError { + TransactionValidationError(TransactionValidationError), + LocatedInstructionSchemaValidationError(LocatedInstructionSchemaValidationError), +} diff --git a/radix-engine-toolkit-core/src/functions/intent.rs b/radix-engine-toolkit-core/src/functions/intent.rs new file mode 100644 index 00000000..c6465633 --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/intent.rs @@ -0,0 +1,48 @@ +// 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 sbor::*; +use scrypto::prelude::*; +use transaction::errors::*; +use transaction::model::*; +use transaction::validation::*; + +pub fn hash(intent: &IntentV1) -> Result { + intent.prepare().map(|prepared| prepared.intent_hash().0) +} + +pub fn compile(intent: &IntentV1) -> Result, EncodeError> { + intent.to_payload_bytes() +} + +pub fn decompile(payload_bytes: T) -> Result +where + T: AsRef<[u8]>, +{ + IntentV1::from_payload_bytes(payload_bytes.as_ref()) +} + +pub fn statically_validate( + intent: &IntentV1, + validation_config: ValidationConfig, +) -> Result<(), TransactionValidationError> { + let validator = NotarizedTransactionValidator::new(validation_config); + intent + .prepare() + .map_err(TransactionValidationError::PrepareError) + .and_then(|prepared| validator.validate_intent_v1(&prepared)) +} diff --git a/radix-engine-toolkit-core/src/functions/manifest.rs b/radix-engine-toolkit-core/src/functions/manifest.rs new file mode 100644 index 00000000..7499402c --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/manifest.rs @@ -0,0 +1,43 @@ +// 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 sbor::*; +use scrypto::prelude::*; +use transaction::errors::*; +use transaction::prelude::*; +use transaction::validation::*; + +pub fn hash(manifest: &TransactionManifestV1) -> Result { + compile(manifest).map(scrypto::prelude::hash) +} + +pub fn compile(manifest: &TransactionManifestV1) -> Result, EncodeError> { + manifest_encode(manifest) +} + +pub fn decompile(payload_bytes: T) -> Result +where + T: AsRef<[u8]>, +{ + manifest_decode(payload_bytes.as_ref()) +} + +pub fn statically_validate( + manifest: &TransactionManifestV1, +) -> Result<(), TransactionValidationError> { + NotarizedTransactionValidator::validate_instructions_v1(&manifest.instructions) +} diff --git a/radix-engine-toolkit-core/src/functions/manifest_sbor.rs b/radix-engine-toolkit-core/src/functions/manifest_sbor.rs new file mode 100644 index 00000000..ccb341ff --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/manifest_sbor.rs @@ -0,0 +1,113 @@ +// 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 sbor::prelude::ContextualSerialize; +use sbor::representations::{SerializationMode, SerializationParameters}; +use sbor::*; +use scrypto::address::*; +use scrypto::prelude::*; +use transaction::data::{format_manifest_value, ManifestDecompilationDisplayContext}; + +pub fn encode(value: &ManifestValue) -> Result, EncodeError> { + manifest_encode(value) +} + +pub fn decode(value: T) -> Result +where + T: AsRef<[u8]>, +{ + manifest_decode(value.as_ref()) +} + +pub fn decode_to_string_representation( + value: T, + representation: ManifestSborStringRepresentation, + bech32_encoder: &AddressBech32Encoder, + schema: Option<(LocalTypeIndex, Schema)>, +) -> Result +where + T: AsRef<[u8]>, +{ + let value = value.as_ref(); + + // Ensure that whatever value was passed either matches the schema if given or is valid Manifest + // sbor. + if let Some((ref local_type_index, ref schema)) = schema { + validate_payload_against_schema::( + value, + schema, + *local_type_index, + &(), + ) + .map_err(|_| ManifestSborError::SchemaValidationError)?; + } else { + decode(value).map_err(ManifestSborError::DecodeError)?; + }; + + let string = match representation { + ManifestSborStringRepresentation::JSON(representation) => { + let context = ManifestValueDisplayContext::with_optional_bech32(Some(bech32_encoder)); + let serialization_parameters = if let Some((ref local_type_index, ref schema)) = schema + { + SerializationParameters::WithSchema { + mode: representation, + custom_context: context, + schema, + type_index: *local_type_index, + } + } else { + SerializationParameters::Schemaless { + mode: representation, + custom_context: context, + } + }; + + let payload = ManifestRawPayload::new_from_valid_slice(value); + let serializable = payload.serializable(serialization_parameters); + serde_json::to_string(&serializable).expect("Impossible Case!") + } + ManifestSborStringRepresentation::ManifestString => { + let context = + ManifestDecompilationDisplayContext::with_optional_bech32(Some(bech32_encoder)); + let mut string = String::new(); + format_manifest_value( + &mut string, + &decode(value).map_err(ManifestSborError::DecodeError)?, + &context, + false, + 0, + ) + .map_err(ManifestSborError::FmtError)?; + string + } + }; + + Ok(string) +} + +#[derive(Debug, Clone)] +pub enum ManifestSborError { + SchemaValidationError, + DecodeError(DecodeError), + FmtError(std::fmt::Error), +} + +#[derive(Clone, Copy)] +pub enum ManifestSborStringRepresentation { + ManifestString, + JSON(SerializationMode), +} diff --git a/radix-engine-toolkit/src/model/engine_identifier/mod.rs b/radix-engine-toolkit-core/src/functions/mod.rs similarity index 79% rename from radix-engine-toolkit/src/model/engine_identifier/mod.rs rename to radix-engine-toolkit-core/src/functions/mod.rs index 25c0bc86..f8b312fe 100644 --- a/radix-engine-toolkit/src/model/engine_identifier/mod.rs +++ b/radix-engine-toolkit-core/src/functions/mod.rs @@ -15,10 +15,16 @@ // specific language governing permissions and limitations // under the License. -pub mod node_identifier; -pub mod own; -pub mod transient_identifier; +pub mod information; -pub use node_identifier::*; -pub use own::*; -pub use transient_identifier::*; +pub mod derive; + +pub mod execution; +pub mod instructions; +pub mod intent; +pub mod manifest; +pub mod notarized_transaction; +pub mod signed_intent; + +pub mod manifest_sbor; +pub mod scrypto_sbor; diff --git a/radix-engine-toolkit-core/src/functions/notarized_transaction.rs b/radix-engine-toolkit-core/src/functions/notarized_transaction.rs new file mode 100644 index 00000000..b0b5300e --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/notarized_transaction.rs @@ -0,0 +1,51 @@ +// 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 sbor::*; +use scrypto::prelude::*; +use transaction::errors::*; +use transaction::model::*; +use transaction::validation::*; + +pub fn hash(notarized_transaction: &NotarizedTransactionV1) -> Result { + notarized_transaction + .prepare() + .map(|prepared| prepared.notarized_transaction_hash().0) +} + +pub fn compile(notarized_transaction: &NotarizedTransactionV1) -> Result, EncodeError> { + notarized_transaction.to_payload_bytes() +} + +pub fn decompile(payload_bytes: T) -> Result +where + T: AsRef<[u8]>, +{ + NotarizedTransactionV1::from_payload_bytes(payload_bytes.as_ref()) +} + +pub fn statically_validate( + notarized_transaction: &NotarizedTransactionV1, + validation_config: ValidationConfig, +) -> Result<(), TransactionValidationError> { + let validator = NotarizedTransactionValidator::new(validation_config); + notarized_transaction + .prepare() + .map_err(TransactionValidationError::PrepareError) + .and_then(|prepared| validator.validate(prepared)) + .map(|_| ()) +} diff --git a/radix-engine-toolkit-core/src/functions/scrypto_sbor.rs b/radix-engine-toolkit-core/src/functions/scrypto_sbor.rs new file mode 100644 index 00000000..e3fcb565 --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/scrypto_sbor.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 sbor::prelude::ContextualSerialize; +use sbor::representations::{SerializationMode, SerializationParameters}; +use sbor::*; +use scrypto::address::*; +use scrypto::prelude::*; + +pub fn encode(value: &ScryptoValue) -> Result, EncodeError> { + scrypto_encode(value) +} + +pub fn decode(value: T) -> Result +where + T: AsRef<[u8]>, +{ + scrypto_decode(value.as_ref()) +} + +pub fn decode_to_string_representation( + value: T, + representation: SerializationMode, + bech32_encoder: &AddressBech32Encoder, + schema: Option<(LocalTypeIndex, Schema)>, +) -> Result +where + T: AsRef<[u8]>, +{ + let value = value.as_ref(); + + // Ensure that whatever value was passed either matches the schema if given or is valid Scrypto + // sbor. + if let Some((ref local_type_index, ref schema)) = schema { + validate_payload_against_schema::( + value, + schema, + *local_type_index, + &(), + ) + .map_err(|_| ScryptoSborError::SchemaValidationError)?; + } else { + decode(value).map_err(ScryptoSborError::DecodeError)?; + }; + + let context = ScryptoValueDisplayContext::with_optional_bech32(Some(bech32_encoder)); + let serialization_parameters = if let Some((ref local_type_index, ref schema)) = schema { + SerializationParameters::WithSchema { + mode: representation, + custom_context: context, + schema, + type_index: *local_type_index, + } + } else { + SerializationParameters::Schemaless { + mode: representation, + custom_context: context, + } + }; + + let payload = ScryptoRawPayload::new_from_valid_slice(value); + let serializable = payload.serializable(serialization_parameters); + let serialized = serde_json::to_string(&serializable).expect("Impossible Case!"); + + Ok(serialized) +} + +#[derive(Debug, Clone)] +pub enum ScryptoSborError { + SchemaValidationError, + DecodeError(DecodeError), +} diff --git a/radix-engine-toolkit-core/src/functions/signed_intent.rs b/radix-engine-toolkit-core/src/functions/signed_intent.rs new file mode 100644 index 00000000..6dcab8a2 --- /dev/null +++ b/radix-engine-toolkit-core/src/functions/signed_intent.rs @@ -0,0 +1,50 @@ +// 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 sbor::*; +use scrypto::prelude::*; +use transaction::errors::*; +use transaction::model::*; +use transaction::validation::*; + +pub fn hash(signed_intent: &SignedIntentV1) -> Result { + signed_intent + .prepare() + .map(|prepared| prepared.signed_intent_hash().0) +} + +pub fn compile(signed_intent: &SignedIntentV1) -> Result, EncodeError> { + signed_intent.to_payload_bytes() +} + +pub fn decompile(payload_bytes: T) -> Result +where + T: AsRef<[u8]>, +{ + SignedIntentV1::from_payload_bytes(payload_bytes.as_ref()) +} + +pub fn statically_validate( + signed_intent: &SignedIntentV1, + validation_config: ValidationConfig, +) -> Result<(), TransactionValidationError> { + let validator = NotarizedTransactionValidator::new(validation_config); + signed_intent + .prepare() + .map_err(TransactionValidationError::PrepareError) + .and_then(|prepared| validator.validate_intent_v1(&prepared.intent)) +} diff --git a/radix-engine-toolkit-core/src/instruction_visitor/core/error.rs b/radix-engine-toolkit-core/src/instruction_visitor/core/error.rs new file mode 100644 index 00000000..f3f1985c --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/core/error.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::instruction_visitor::visitors::transaction_type::general_transaction_visitor::LocatedGeneralTransactionTypeError; +use crate::instruction_visitor::visitors::transaction_type::transfer_visitor::TransferTransactionTypeError; +use std::convert::Infallible; + +#[derive(Debug, Clone)] +pub enum InstructionVisitorError { + Infallible(Infallible), + TransferTransactionTypeError(TransferTransactionTypeError), + LocatedGeneralTransactionTypeError(LocatedGeneralTransactionTypeError), +} + +impl From for InstructionVisitorError { + fn from(error: Infallible) -> Self { + Self::Infallible(error) + } +} + +impl From for InstructionVisitorError { + fn from(value: TransferTransactionTypeError) -> Self { + Self::TransferTransactionTypeError(value) + } +} + +impl From for InstructionVisitorError { + fn from(value: LocatedGeneralTransactionTypeError) -> Self { + Self::LocatedGeneralTransactionTypeError(value) + } +} diff --git a/cli-json-interface/src/subcommands/sbor/mod.rs b/radix-engine-toolkit-core/src/instruction_visitor/core/macros.rs similarity index 66% rename from cli-json-interface/src/subcommands/sbor/mod.rs rename to radix-engine-toolkit-core/src/instruction_visitor/core/macros.rs index a0845acf..b722a5e8 100644 --- a/cli-json-interface/src/subcommands/sbor/mod.rs +++ b/radix-engine-toolkit-core/src/instruction_visitor/core/macros.rs @@ -5,9 +5,9 @@ // 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 @@ -15,21 +15,20 @@ // 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), -} +#![allow(unused_macros, unused_imports)] -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), +#[macro_export] +macro_rules! traverse_instructions { + ( + $instructions: expr, + $( $visitor: ident ),* $(,)? + ) => { + { + $crate::instruction_visitor::core::traverser::traverse($instructions, &mut [$(&mut $visitor),*]).map(|_| ( + $( + $visitor.output() + ),* + )) } - } + }; } diff --git a/radix-engine-toolkit/src/model/value/mod.rs b/radix-engine-toolkit-core/src/instruction_visitor/core/mod.rs similarity index 93% rename from radix-engine-toolkit/src/model/value/mod.rs rename to radix-engine-toolkit-core/src/instruction_visitor/core/mod.rs index f09ebeee..6e11273c 100644 --- a/radix-engine-toolkit/src/model/value/mod.rs +++ b/radix-engine-toolkit-core/src/instruction_visitor/core/mod.rs @@ -15,7 +15,7 @@ // specific language governing permissions and limitations // under the License. -pub mod ast; +pub mod error; pub mod macros; -pub mod manifest_sbor; -pub mod scrypto_sbor; +pub mod traits; +pub mod traverser; diff --git a/radix-engine-toolkit-core/src/instruction_visitor/core/traits.rs b/radix-engine-toolkit-core/src/instruction_visitor/core/traits.rs new file mode 100644 index 00000000..b2619fb2 --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/core/traits.rs @@ -0,0 +1,292 @@ +// 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(unused)] + +use super::error::InstructionVisitorError; +use scrypto::prelude::*; +use transaction::prelude::{DynamicGlobalAddress, DynamicPackageAddress, InstructionV1}; + +pub trait InstructionVisitor { + //===== + // Raw + //===== + + #[inline] + fn visit_instruction( + &mut self, + instruction: &InstructionV1, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + //============== + // Instructions + //============== + + #[inline] + fn visit_take_all_from_worktop( + &mut self, + resource_address: &ResourceAddress, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_take_from_worktop( + &mut self, + resource_address: &ResourceAddress, + amount: &Decimal, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_take_non_fungibles_from_worktop( + &mut self, + resource_address: &ResourceAddress, + ids: &[NonFungibleLocalId], + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_return_to_worktop( + &mut self, + bucket_id: &ManifestBucket, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_assert_worktop_contains( + &mut self, + resource_address: &ResourceAddress, + amount: &Decimal, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_assert_worktop_contains_any( + &mut self, + resource_address: &ResourceAddress, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_assert_worktop_contains_non_fungibles( + &mut self, + resource_address: &ResourceAddress, + ids: &[NonFungibleLocalId], + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_pop_from_auth_zone(&mut self) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_push_to_auth_zone( + &mut self, + proof_id: &ManifestProof, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_clear_auth_zone(&mut self) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_create_proof_from_auth_zone_of_amount( + &mut self, + resource_address: &ResourceAddress, + amount: &Decimal, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_create_proof_from_auth_zone_of_non_fungibles( + &mut self, + resource_address: &ResourceAddress, + ids: &[NonFungibleLocalId], + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_create_proof_from_auth_zone_of_all( + &mut self, + resource_address: &ResourceAddress, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_clear_signature_proofs(&mut self) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_create_proof_from_bucket_of_amount( + &mut self, + bucket_id: &ManifestBucket, + amount: &Decimal, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_create_proof_from_bucket_of_non_fungibles( + &mut self, + bucket_id: &ManifestBucket, + ids: &[NonFungibleLocalId], + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_create_proof_from_bucket_of_all( + &mut self, + bucket_id: &ManifestBucket, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_burn_resource( + &mut self, + bucket_id: &ManifestBucket, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_clone_proof( + &mut self, + proof_id: &ManifestProof, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_drop_proof( + &mut self, + proof_id: &ManifestProof, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_call_function( + &mut self, + package_address: &DynamicPackageAddress, + blueprint_name: &str, + function_name: &str, + args: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_call_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + args: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_call_royalty_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + args: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_call_metadata_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + args: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_call_access_rules_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + args: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_call_direct_vault_method( + &mut self, + vault_id: &InternalAddress, + method_name: &str, + args: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_drop_all_proofs(&mut self) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + #[inline] + fn visit_allocate_global_address( + &mut self, + package_address: &PackageAddress, + blueprint_name: &str, + ) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + //======== + // Events + //======== + + #[inline] + fn post_visit(&mut self) -> Result<(), InstructionVisitorError> { + Ok(()) + } + + //======= + // State + //======= + + #[inline] + fn is_enabled(&self) -> bool { + true + } +} diff --git a/radix-engine-toolkit-core/src/instruction_visitor/core/traverser.rs b/radix-engine-toolkit-core/src/instruction_visitor/core/traverser.rs new file mode 100644 index 00000000..af612161 --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/core/traverser.rs @@ -0,0 +1,234 @@ +// 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::error::InstructionVisitorError; +use super::traits::InstructionVisitor; +use transaction::prelude::InstructionV1; + +pub fn traverse( + instructions: &[InstructionV1], + visitors: &mut [&mut dyn InstructionVisitor], +) -> Result<(), InstructionVisitorError> { + for instruction in instructions { + for_each_enabled_visitor!(visitors, visit_instruction(instruction)); + match instruction { + InstructionV1::TakeAllFromWorktop { resource_address } => { + for_each_enabled_visitor!(visitors, visit_take_all_from_worktop(resource_address)); + } + InstructionV1::TakeFromWorktop { + resource_address, + amount, + } => { + for_each_enabled_visitor!( + visitors, + visit_take_from_worktop(resource_address, amount) + ); + } + InstructionV1::TakeNonFungiblesFromWorktop { + resource_address, + ids, + } => { + for_each_enabled_visitor!( + visitors, + visit_take_non_fungibles_from_worktop(resource_address, ids) + ); + } + InstructionV1::ReturnToWorktop { bucket_id } => { + for_each_enabled_visitor!(visitors, visit_return_to_worktop(bucket_id)) + } + InstructionV1::AssertWorktopContainsAny { resource_address } => { + for_each_enabled_visitor!( + visitors, + visit_assert_worktop_contains_any(resource_address) + ) + } + InstructionV1::AssertWorktopContains { + resource_address, + amount, + } => { + for_each_enabled_visitor!( + visitors, + visit_assert_worktop_contains(resource_address, amount) + ) + } + InstructionV1::AssertWorktopContainsNonFungibles { + resource_address, + ids, + } => { + for_each_enabled_visitor!( + visitors, + visit_assert_worktop_contains_non_fungibles(resource_address, ids) + ) + } + InstructionV1::PopFromAuthZone {} => { + for_each_enabled_visitor!(visitors, visit_pop_from_auth_zone()) + } + InstructionV1::PushToAuthZone { proof_id } => { + for_each_enabled_visitor!(visitors, visit_push_to_auth_zone(proof_id)) + } + InstructionV1::ClearAuthZone => { + for_each_enabled_visitor!(visitors, visit_clear_auth_zone()) + } + + InstructionV1::CreateProofFromAuthZoneOfAmount { + resource_address, + amount, + } => { + for_each_enabled_visitor!( + visitors, + visit_create_proof_from_auth_zone_of_amount(resource_address, amount) + ) + } + InstructionV1::CreateProofFromAuthZoneOfNonFungibles { + resource_address, + ids, + } => { + for_each_enabled_visitor!( + visitors, + visit_create_proof_from_auth_zone_of_non_fungibles(resource_address, ids) + ) + } + InstructionV1::CreateProofFromAuthZoneOfAll { resource_address } => { + for_each_enabled_visitor!( + visitors, + visit_create_proof_from_auth_zone_of_all(resource_address) + ) + } + InstructionV1::ClearSignatureProofs {} => { + for_each_enabled_visitor!(visitors, visit_clear_signature_proofs()) + } + InstructionV1::CreateProofFromBucketOfAmount { bucket_id, amount } => { + for_each_enabled_visitor!( + visitors, + visit_create_proof_from_bucket_of_amount(bucket_id, amount) + ) + } + InstructionV1::CreateProofFromBucketOfNonFungibles { bucket_id, ids } => { + for_each_enabled_visitor!( + visitors, + visit_create_proof_from_bucket_of_non_fungibles(bucket_id, ids) + ) + } + InstructionV1::CreateProofFromBucketOfAll { bucket_id } => { + for_each_enabled_visitor!( + visitors, + visit_create_proof_from_bucket_of_all(bucket_id) + ) + } + InstructionV1::BurnResource { bucket_id } => { + for_each_enabled_visitor!(visitors, visit_burn_resource(bucket_id)) + } + InstructionV1::CloneProof { proof_id } => { + for_each_enabled_visitor!(visitors, visit_clone_proof(proof_id)) + } + InstructionV1::DropProof { proof_id } => { + for_each_enabled_visitor!(visitors, visit_drop_proof(proof_id)) + } + InstructionV1::CallFunction { + package_address, + blueprint_name, + function_name, + args, + } => { + for_each_enabled_visitor!( + visitors, + visit_call_function(package_address, blueprint_name, function_name, args) + ) + } + InstructionV1::CallMethod { + address, + method_name, + args, + } => { + for_each_enabled_visitor!(visitors, visit_call_method(address, method_name, args)) + } + InstructionV1::CallRoyaltyMethod { + address, + method_name, + args, + } => { + for_each_enabled_visitor!( + visitors, + visit_call_royalty_method(address, method_name, args) + ) + } + InstructionV1::CallMetadataMethod { + address, + method_name, + args, + } => { + for_each_enabled_visitor!( + visitors, + visit_call_metadata_method(address, method_name, args) + ) + } + InstructionV1::CallAccessRulesMethod { + address, + method_name, + args, + } => { + for_each_enabled_visitor!( + visitors, + visit_call_access_rules_method(address, method_name, args) + ) + } + InstructionV1::CallDirectVaultMethod { + address, + method_name, + args, + } => { + for_each_enabled_visitor!( + visitors, + visit_call_direct_vault_method(address, method_name, args) + ) + } + InstructionV1::DropAllProofs => { + for_each_enabled_visitor!(visitors, visit_drop_all_proofs()) + } + InstructionV1::AllocateGlobalAddress { + package_address, + blueprint_name, + } => { + for_each_enabled_visitor!( + visitors, + visit_allocate_global_address(package_address, blueprint_name) + ) + } + } + + for visitor in visitors.iter_mut() { + if visitor.is_enabled() { + visitor.post_visit()?; + } + } + } + + Ok(()) +} + +macro_rules! for_each_enabled_visitor { + ($visitors: expr, $method_ident: ident ( $($arg: ident),* $(,)? )) => { + for visitor in $visitors.iter_mut() { + if visitor.is_enabled() { + visitor.$method_ident( + $($arg),* + )?; + } + } + }; +} +use for_each_enabled_visitor; diff --git a/radix-engine-toolkit/src/model/value/ast/mod.rs b/radix-engine-toolkit-core/src/instruction_visitor/mod.rs similarity index 92% rename from radix-engine-toolkit/src/model/value/ast/mod.rs rename to radix-engine-toolkit-core/src/instruction_visitor/mod.rs index d592a121..1da3cb39 100644 --- a/radix-engine-toolkit/src/model/value/ast/mod.rs +++ b/radix-engine-toolkit-core/src/instruction_visitor/mod.rs @@ -15,8 +15,5 @@ // specific language governing permissions and limitations // under the License. -pub mod bridge; -pub mod model; - -pub use bridge::*; -pub use model::*; +pub mod core; +pub mod visitors; diff --git a/radix-engine-toolkit-core/src/instruction_visitor/visitors/account_interactions_visitor.rs b/radix-engine-toolkit-core/src/instruction_visitor/visitors/account_interactions_visitor.rs new file mode 100644 index 00000000..50a4aa7d --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/visitors/account_interactions_visitor.rs @@ -0,0 +1,159 @@ +// 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::instruction_visitor::core::error::InstructionVisitorError; +use crate::instruction_visitor::core::traits::InstructionVisitor; +use crate::utils::is_account; +use scrypto::prelude::*; +use transaction::prelude::DynamicGlobalAddress; + +#[derive(Default, Clone, Debug)] +pub struct AccountInteractionsVisitor { + accounts_requiring_auth: HashSet, + accounts_withdrawn_from: HashSet, + accounts_deposited_into: HashSet, +} + +impl AccountInteractionsVisitor { + pub fn output( + self, + ) -> ( + HashSet, + HashSet, + HashSet, + ) { + ( + self.accounts_requiring_auth, + self.accounts_withdrawn_from, + self.accounts_deposited_into, + ) + } +} + +impl InstructionVisitor for AccountInteractionsVisitor { + fn visit_call_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_account(address) { + let component_address = match address { + DynamicGlobalAddress::Static(address) => { + ComponentAddress::new_or_panic(address.as_node_id().0) + } + DynamicGlobalAddress::Named(_) => { + return Ok(()); + } + }; + + if crate::statics::ACCOUNT_METHODS_THAT_REQUIRE_AUTH + .iter() + .any(|MethodKey { ident }| ident.as_str() == method_name) + { + self.accounts_requiring_auth.insert(component_address); + } + + if crate::statics::ACCOUNT_DEPOSIT_METHODS.contains(&method_name.to_owned()) { + self.accounts_deposited_into.insert(component_address); + } + + if crate::statics::ACCOUNT_WITHDRAW_METHODS.contains(&method_name.to_owned()) { + self.accounts_withdrawn_from.insert(component_address); + } + }; + Ok(()) + } + + fn visit_call_access_rules_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_account(address) { + let component_address = match address { + DynamicGlobalAddress::Static(address) => { + ComponentAddress::new_or_panic(address.as_node_id().0) + } + DynamicGlobalAddress::Named(_) => { + return Ok(()); + } + }; + + if crate::statics::ACCESS_RULES_METHODS_THAT_REQUIRE_AUTH + .iter() + .any(|MethodKey { ident }| ident.as_str() == method_name) + { + self.accounts_requiring_auth.insert(component_address); + } + } + Ok(()) + } + + fn visit_call_metadata_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_account(address) { + let component_address = match address { + DynamicGlobalAddress::Static(address) => { + ComponentAddress::new_or_panic(address.as_node_id().0) + } + DynamicGlobalAddress::Named(_) => { + return Ok(()); + } + }; + + if crate::statics::METADATA_METHODS_THAT_REQUIRE_AUTH + .iter() + .any(|MethodKey { ident }| ident.as_str() == method_name) + { + self.accounts_requiring_auth.insert(component_address); + } + } + Ok(()) + } + + fn visit_call_royalty_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_account(address) { + let component_address = match address { + DynamicGlobalAddress::Static(address) => { + ComponentAddress::new_or_panic(address.as_node_id().0) + } + DynamicGlobalAddress::Named(_) => { + return Ok(()); + } + }; + + if crate::statics::ROYALTY_METHODS_THAT_REQUIRE_AUTH + .iter() + .any(|MethodKey { ident }| ident.as_str() == method_name) + { + self.accounts_requiring_auth.insert(component_address); + } + } + Ok(()) + } +} diff --git a/radix-engine-toolkit-core/src/instruction_visitor/visitors/account_proofs_visitor.rs b/radix-engine-toolkit-core/src/instruction_visitor/visitors/account_proofs_visitor.rs new file mode 100644 index 00000000..af52852a --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/visitors/account_proofs_visitor.rs @@ -0,0 +1,61 @@ +// 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 sbor::prelude::*; +use scrypto::prelude::*; +use transaction::prelude::DynamicGlobalAddress; + +use crate::instruction_visitor::core::error::InstructionVisitorError; +use crate::instruction_visitor::core::traits::InstructionVisitor; +use crate::sbor::indexed_manifest_value::IndexedManifestValue; +use crate::statics::ACCOUNT_PROOF_CREATION_METHODS; +use crate::utils::is_account; + +#[derive(Default, Clone)] +pub struct AccountProofsVisitor(HashSet); + +impl AccountProofsVisitor { + pub fn output(self) -> HashSet { + self.0 + } +} + +impl InstructionVisitor for AccountProofsVisitor { + fn visit_call_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + args: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_account(address) && ACCOUNT_PROOF_CREATION_METHODS.contains(&method_name.to_owned()) { + self.0.extend( + IndexedManifestValue::from_manifest_value(args) + .static_addresses() + .iter() + .filter_map(|node_id| { + if node_id.is_global_resource_manager() { + Some(ResourceAddress::new_or_panic(node_id.0)) + } else { + None + } + }), + ) + } + + Ok(()) + } +} diff --git a/radix-engine-toolkit-core/src/instruction_visitor/visitors/identity_interactions_visitor.rs b/radix-engine-toolkit-core/src/instruction_visitor/visitors/identity_interactions_visitor.rs new file mode 100644 index 00000000..34be3f6d --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/visitors/identity_interactions_visitor.rs @@ -0,0 +1,137 @@ +// 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::instruction_visitor::core::error::InstructionVisitorError; +use crate::instruction_visitor::core::traits::InstructionVisitor; +use crate::utils::is_identity; +use scrypto::prelude::*; +use transaction::prelude::DynamicGlobalAddress; + +#[derive(Clone, Default)] +pub struct IdentityInteractionsVisitor(HashSet); + +impl IdentityInteractionsVisitor { + pub fn output(self) -> HashSet { + self.0 + } +} + +impl InstructionVisitor for IdentityInteractionsVisitor { + fn visit_call_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_identity(address) { + let component_address = match address { + DynamicGlobalAddress::Static(address) => { + ComponentAddress::new_or_panic(address.as_node_id().0) + } + DynamicGlobalAddress::Named(_) => { + return Ok(()); + } + }; + + if crate::statics::IDENTITY_METHODS_THAT_REQUIRE_AUTH + .iter() + .any(|MethodKey { ident }| ident.as_str() == method_name) + { + self.0.insert(component_address); + } + }; + Ok(()) + } + + fn visit_call_access_rules_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_identity(address) { + let component_address = match address { + DynamicGlobalAddress::Static(address) => { + ComponentAddress::new_or_panic(address.as_node_id().0) + } + DynamicGlobalAddress::Named(_) => { + return Ok(()); + } + }; + + if crate::statics::ACCESS_RULES_METHODS_THAT_REQUIRE_AUTH + .iter() + .any(|MethodKey { ident }| ident.as_str() == method_name) + { + self.0.insert(component_address); + } + } + Ok(()) + } + + fn visit_call_metadata_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_identity(address) { + let component_address = match address { + DynamicGlobalAddress::Static(address) => { + ComponentAddress::new_or_panic(address.as_node_id().0) + } + DynamicGlobalAddress::Named(_) => { + return Ok(()); + } + }; + + if crate::statics::METADATA_METHODS_THAT_REQUIRE_AUTH + .iter() + .any(|MethodKey { ident }| ident.as_str() == method_name) + { + self.0.insert(component_address); + } + } + Ok(()) + } + + fn visit_call_royalty_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_identity(address) { + let component_address = match address { + DynamicGlobalAddress::Static(address) => { + ComponentAddress::new_or_panic(address.as_node_id().0) + } + DynamicGlobalAddress::Named(_) => { + return Ok(()); + } + }; + + if crate::statics::ROYALTY_METHODS_THAT_REQUIRE_AUTH + .iter() + .any(|MethodKey { ident }| ident.as_str() == method_name) + { + self.0.insert(component_address); + } + } + Ok(()) + } +} diff --git a/radix-engine-toolkit-core/src/instruction_visitor/visitors/mod.rs b/radix-engine-toolkit-core/src/instruction_visitor/visitors/mod.rs new file mode 100644 index 00000000..0093e9a8 --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/visitors/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 account_interactions_visitor; +pub mod account_proofs_visitor; +pub mod identity_interactions_visitor; +pub mod transaction_type; diff --git a/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/general_transaction_visitor.rs b/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/general_transaction_visitor.rs new file mode 100644 index 00000000..d5150c8b --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/general_transaction_visitor.rs @@ -0,0 +1,444 @@ +// 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::match_like_matches_macro)] + +use crate::instruction_visitor::core::error::InstructionVisitorError; +use crate::instruction_visitor::core::traits::InstructionVisitor; +use crate::sbor::indexed_manifest_value::IndexedManifestValue; +use crate::statics::ACCOUNT_WITHDRAW_METHODS; +use crate::utils::is_account; + +use radix_engine::system::system_modules::execution_trace::ResourceSpecifier; +use radix_engine::system::system_modules::execution_trace::WorktopChange; +use radix_engine::transaction::*; +use radix_engine_common::prelude::*; +use scrypto::blueprints::access_controller::*; +use scrypto::blueprints::account::*; +use scrypto::prelude::*; +use transaction::prelude::*; +use transaction::validation::ManifestIdAllocator; + +pub struct GeneralTransactionTypeVisitor<'r> { + /// The execution trace from the preview receipt + execution_trace: &'r TransactionExecutionTrace, + + /// Tracks if the visitor is currently in an illegal state or not. + is_illegal_state: bool, + + /// The withdraws from the account + account_withdraws: HashMap>, + + /// The deposits to the accounts + account_deposits: HashMap>>, + + /// Used to allocate new ids + id_allocator: ManifestIdAllocator, + + /// Tracks the buckets and their contents + bucket_tracker: HashMap>, + + /// The index of the current instruction + instruction_index: usize, +} + +impl<'r> InstructionVisitor for GeneralTransactionTypeVisitor<'r> { + fn is_enabled(&self) -> bool { + !self.is_illegal_state + } + + fn post_visit(&mut self) -> Result<(), InstructionVisitorError> { + self.instruction_index += 1; + Ok(()) + } + + fn visit_instruction( + &mut self, + instruction: &InstructionV1, + ) -> Result<(), InstructionVisitorError> { + match instruction { + /* Calling method or function */ + InstructionV1::CallFunction { + package_address, + blueprint_name, + function_name, + args, + } => self + .handle_call_function(package_address, blueprint_name, function_name, args) + .map_err(|error| { + InstructionVisitorError::LocatedGeneralTransactionTypeError( + LocatedGeneralTransactionTypeError { + instruction_index: self.instruction_index, + error, + }, + ) + })?, + InstructionV1::CallMethod { + address, + method_name, + args, + } => self + .handle_call_method(address, method_name, args) + .map_err(|error| { + InstructionVisitorError::LocatedGeneralTransactionTypeError( + LocatedGeneralTransactionTypeError { + instruction_index: self.instruction_index, + error, + }, + ) + })?, + + /* Worktop take and return */ + InstructionV1::TakeFromWorktop { + resource_address, + amount, + } => self + .handle_take_from_worktop(resource_address, amount) + .map_err(|error| LocatedGeneralTransactionTypeError { + error, + instruction_index: self.instruction_index, + })?, + InstructionV1::TakeAllFromWorktop { resource_address } => self + .handle_take_all_from_worktop(resource_address) + .map_err(|error| LocatedGeneralTransactionTypeError { + error, + instruction_index: self.instruction_index, + })?, + InstructionV1::TakeNonFungiblesFromWorktop { + resource_address, + ids, + } => self + .handle_take_non_fungibles_from_worktop( + resource_address, + &ids.iter().cloned().collect(), + ) + .map_err(|error| LocatedGeneralTransactionTypeError { + error, + instruction_index: self.instruction_index, + })?, + InstructionV1::ReturnToWorktop { bucket_id } => self + .handle_return_to_worktop(bucket_id) + .map_err(|error| LocatedGeneralTransactionTypeError { + error, + instruction_index: self.instruction_index, + })?, + + /* Non-main module method put the visitor in illegal state */ + InstructionV1::CallRoyaltyMethod { .. } + | InstructionV1::CallMetadataMethod { .. } + | InstructionV1::CallAccessRulesMethod { .. } => { + self.is_illegal_state = true; + } + + /* Direct Vault method and recall put the visitor in illegal state */ + InstructionV1::BurnResource { .. } | InstructionV1::CallDirectVaultMethod { .. } => { + self.is_illegal_state = true + } + + /* Allowed Instructions */ + InstructionV1::AssertWorktopContains { .. } + | InstructionV1::AssertWorktopContainsAny { .. } + | InstructionV1::AssertWorktopContainsNonFungibles { .. } + | InstructionV1::PopFromAuthZone + | InstructionV1::PushToAuthZone { .. } + | InstructionV1::ClearAuthZone + | InstructionV1::CreateProofFromAuthZoneOfAmount { .. } + | InstructionV1::CreateProofFromAuthZoneOfNonFungibles { .. } + | InstructionV1::CreateProofFromAuthZoneOfAll { .. } + | InstructionV1::ClearSignatureProofs + | InstructionV1::CreateProofFromBucketOfAmount { .. } + | InstructionV1::CreateProofFromBucketOfNonFungibles { .. } + | InstructionV1::CreateProofFromBucketOfAll { .. } + | InstructionV1::CloneProof { .. } + | InstructionV1::DropProof { .. } + | InstructionV1::DropAllProofs + | InstructionV1::AllocateGlobalAddress { .. } => {} + } + Ok(()) + } +} + +impl<'r> GeneralTransactionTypeVisitor<'r> { + pub fn new(execution_trace: &'r TransactionExecutionTrace) -> Self { + Self { + execution_trace, + is_illegal_state: Default::default(), + account_withdraws: Default::default(), + account_deposits: Default::default(), + instruction_index: Default::default(), + id_allocator: Default::default(), + bucket_tracker: Default::default(), + } + } + + #[allow(clippy::type_complexity)] + pub fn output( + self, + ) -> Option<( + HashMap>, + HashMap>>, + )> { + if self.is_illegal_state { + None + } else { + Some((self.account_withdraws, self.account_deposits)) + } + } + + pub fn handle_call_function( + &mut self, + _: &DynamicPackageAddress, + _: &str, + _: &str, + args: &ManifestValue, + ) -> Result<(), GeneralTransactionTypeError> { + // Handle passed buckets + let indexed_manifest_value = IndexedManifestValue::from_manifest_value(args); + for bucket in indexed_manifest_value.buckets() { + self.bucket_tracker + .remove(bucket) + .ok_or(GeneralTransactionTypeError::UnknownBucket(*bucket))?; + } + + Ok(()) + } + + pub fn handle_call_method( + &mut self, + global_address: &DynamicGlobalAddress, + method_name: &str, + args: &ManifestValue, + ) -> Result<(), GeneralTransactionTypeError> { + // Filter: We only permit static address - no dynamic or named addresses are allowed + let global_address = if let DynamicGlobalAddress::Static(address) = global_address { + address + } else { + self.is_illegal_state = true; + return Ok(()); + }; + + // Filter: Some method calls to certain objects put the visitor in an illegal state + if !global_address + .as_node_id() + .entity_type() + .map_or(false, |entity_type| match entity_type { + /* Allowed */ + EntityType::GlobalGenericComponent + | EntityType::GlobalAccount + | EntityType::GlobalIdentity + | EntityType::GlobalOneResourcePool + | EntityType::GlobalTwoResourcePool + | EntityType::GlobalMultiResourcePool + | EntityType::GlobalVirtualSecp256k1Account + | EntityType::GlobalVirtualSecp256k1Identity + | EntityType::GlobalVirtualEd25519Account + | EntityType::GlobalVirtualEd25519Identity + | EntityType::InternalGenericComponent => true, + + /* Some are allowed */ + EntityType::GlobalAccessController => { + method_name == ACCESS_CONTROLLER_CREATE_PROOF_IDENT + } + + /* Not Allowed */ + EntityType::GlobalPackage + | EntityType::GlobalValidator + | EntityType::GlobalFungibleResourceManager + | EntityType::GlobalNonFungibleResourceManager + | EntityType::InternalAccount + | EntityType::GlobalConsensusManager + | EntityType::InternalFungibleVault + | EntityType::InternalNonFungibleVault + | EntityType::InternalKeyValueStore + | EntityType::GlobalTransactionTracker => false, + }) + { + self.is_illegal_state = true; + return Ok(()); + } + + let component_address = ComponentAddress::new_or_panic(global_address.as_node_id().0); + + if ACCOUNT_WITHDRAW_METHODS.contains(&method_name.to_string()) && is_account(global_address) + { + let withdrawn_resources = self + .execution_trace + .worktop_changes() + .get(&self.instruction_index) + .and_then(|worktop_changes| worktop_changes.first()) + .and_then(|worktop_change| match worktop_change { + WorktopChange::Put(put) => Some(put), + WorktopChange::Take(..) => None, + }) + .ok_or(GeneralTransactionTypeError::WorktopChangesError) + .cloned()?; + self.account_withdraws + .entry(component_address) + .or_default() + .push(withdrawn_resources); + } else if [ + ACCOUNT_DEPOSIT_IDENT, + ACCOUNT_DEPOSIT_BATCH_IDENT, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + ACCOUNT_TRY_DEPOSIT_BATCH_OR_ABORT_IDENT, + ] + .contains(&method_name) + && is_account(global_address) + { + let indexed_manifest_value = IndexedManifestValue::from_manifest_value(args); + + let buckets = indexed_manifest_value.buckets(); + let expressions = indexed_manifest_value.expressions(); + if !expressions.is_empty() { + let worktop_changes = self + .execution_trace + .worktop_changes() + .get(&self.instruction_index) + .map(|worktop_changes| { + worktop_changes + .iter() + .filter_map(|worktop_change| match worktop_change { + WorktopChange::Put(..) => None, + WorktopChange::Take(take) => { + Some(Source::Predicted(self.instruction_index, take.clone())) + } + }) + .collect::>() + }) + .ok_or(GeneralTransactionTypeError::WorktopChangesError)?; + self.account_deposits + .entry(component_address) + .or_default() + .extend(worktop_changes) + } else if !buckets.is_empty() { + for bucket in buckets { + let bucket_amount = self + .bucket_tracker + .remove(bucket) + .ok_or(GeneralTransactionTypeError::UnknownBucket(*bucket))?; + self.account_deposits + .entry(component_address) + .or_default() + .push(bucket_amount) + } + } + } else { + let indexed_manifest_value = IndexedManifestValue::from_manifest_value(args); + for bucket in indexed_manifest_value.buckets() { + self.bucket_tracker + .remove(bucket) + .ok_or(GeneralTransactionTypeError::UnknownBucket(*bucket))?; + } + } + + Ok(()) + } + + pub fn handle_take_from_worktop( + &mut self, + resource_address: &ResourceAddress, + amount: &Decimal, + ) -> Result<(), GeneralTransactionTypeError> { + let bucket = self.id_allocator.new_bucket_id(); + let resource_specifier = ResourceSpecifier::Amount(*resource_address, *amount); + self.bucket_tracker + .insert(bucket, Source::Guaranteed(resource_specifier)); + Ok(()) + } + + pub fn handle_take_non_fungibles_from_worktop( + &mut self, + resource_address: &ResourceAddress, + ids: &BTreeSet, + ) -> Result<(), GeneralTransactionTypeError> { + let bucket = self.id_allocator.new_bucket_id(); + let resource_specifier = ResourceSpecifier::Ids(*resource_address, ids.clone()); + self.bucket_tracker + .insert(bucket, Source::Guaranteed(resource_specifier)); + Ok(()) + } + + pub fn handle_take_all_from_worktop( + &mut self, + _: &ResourceAddress, + ) -> Result<(), GeneralTransactionTypeError> { + let bucket = self.id_allocator.new_bucket_id(); + let resource_specifier = self + .execution_trace + .worktop_changes() + .get(&self.instruction_index) + .and_then(|worktop_changes| worktop_changes.first()) + .and_then(|worktop_change| match worktop_change { + WorktopChange::Take(take) => Some(take), + WorktopChange::Put(..) => None, + }) + .ok_or(GeneralTransactionTypeError::WorktopChangesError) + .cloned()?; + self.bucket_tracker.insert( + bucket, + Source::Predicted(self.instruction_index, resource_specifier), + ); + Ok(()) + } + + pub fn handle_return_to_worktop( + &mut self, + bucket: &ManifestBucket, + ) -> Result<(), GeneralTransactionTypeError> { + self.bucket_tracker + .remove(bucket) + .ok_or(GeneralTransactionTypeError::UnknownBucket(*bucket))?; + Ok(()) + } +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum Source { + Guaranteed(T), + Predicted(usize, T), +} + +impl std::ops::Deref for Source { + type Target = T; + + fn deref(&self) -> &Self::Target { + match self { + Self::Guaranteed(target) | Self::Predicted(_, target) => target, + } + } +} + +impl std::ops::DerefMut for Source { + fn deref_mut(&mut self) -> &mut Self::Target { + match self { + Self::Guaranteed(target) | Self::Predicted(_, target) => target, + } + } +} + +#[derive(Debug, Clone)] +pub enum GeneralTransactionTypeError { + ReceiptOfAFailedOrRejectedTransaction, + WorktopChangesError, + UnknownBucket(ManifestBucket), +} + +#[derive(Debug, Clone)] +pub struct LocatedGeneralTransactionTypeError { + pub instruction_index: usize, + pub error: GeneralTransactionTypeError, +} diff --git a/radix-engine-toolkit/src/example/transaction/mod.rs b/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/mod.rs similarity index 89% rename from radix-engine-toolkit/src/example/transaction/mod.rs rename to radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/mod.rs index 85a8929c..d054df5d 100644 --- a/radix-engine-toolkit/src/example/transaction/mod.rs +++ b/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/mod.rs @@ -15,6 +15,6 @@ // specific language governing permissions and limitations // under the License. -pub mod header; -pub mod instruction_list; -pub mod transaction_structure; +pub mod general_transaction_visitor; +pub mod simple_transfer_visitor; +pub mod transfer_visitor; diff --git a/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/simple_transfer_visitor.rs b/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/simple_transfer_visitor.rs new file mode 100644 index 00000000..3662413a --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/simple_transfer_visitor.rs @@ -0,0 +1,481 @@ +// 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::instruction_visitor::core::error::InstructionVisitorError; +use crate::instruction_visitor::core::traits::InstructionVisitor; +use crate::utils::*; +use radix_engine::system::system_modules::execution_trace::ResourceSpecifier; +use scrypto::blueprints::account::*; +use scrypto::prelude::*; +use transaction::prelude::{DynamicGlobalAddress, DynamicPackageAddress}; + +#[derive(Default, Debug, Clone)] +pub struct SimpleTransactionTypeVisitor { + illegal_instruction_encountered: bool, + state_machine: StateMachine, +} + +impl SimpleTransactionTypeVisitor { + pub fn output(self) -> Option<(ComponentAddress, ComponentAddress, ResourceSpecifier)> { + if self.illegal_instruction_encountered { + None + } else if let Ok((from_account, to_account, resource_specifier)) = + self.state_machine.output() + { + Some((from_account, to_account, resource_specifier)) + } else { + None + } + } +} + +impl InstructionVisitor for SimpleTransactionTypeVisitor { + fn is_enabled(&self) -> bool { + !self.illegal_instruction_encountered + } + + #[inline] + fn visit_call_method( + &mut self, + address: &DynamicGlobalAddress, + method_name: &str, + args: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + if is_account(address) { + let component_address = match address { + DynamicGlobalAddress::Static(address) => { + ComponentAddress::new_or_panic(address.as_node_id().0) + } + DynamicGlobalAddress::Named(_) => { + self.illegal_instruction_encountered = true; + return Ok(()); + } + }; + + if method_name == ACCOUNT_LOCK_FEE_IDENT { + let _ = self.state_machine.transition_to_lock_fee().map_err(|_| { + self.illegal_instruction_encountered = true; + }); + } else if let ( + ACCOUNT_WITHDRAW_IDENT, + Some(AccountWithdrawInput { + resource_address, + amount, + }), + ) = (method_name, to_manifest_type(args)) + { + let _ = self + .state_machine + .transition_to_account_withdraw( + component_address, + ResourceSpecifier::Amount(resource_address, amount), + ) + .map_err(|_| { + self.illegal_instruction_encountered = true; + }); + } else if let ( + ACCOUNT_WITHDRAW_NON_FUNGIBLES_IDENT, + Some(AccountWithdrawNonFungiblesInput { + resource_address, + ids, + }), + ) = (method_name, to_manifest_type(args)) + { + let _ = self + .state_machine + .transition_to_account_withdraw( + component_address, + ResourceSpecifier::Ids(resource_address, ids), + ) + .map_err(|_| { + self.illegal_instruction_encountered = true; + }); + } else if let ( + ACCOUNT_LOCK_FEE_AND_WITHDRAW_IDENT, + Some(AccountLockFeeAndWithdrawInput { + amount, + resource_address, + .. + }), + ) = (method_name, to_manifest_type(args)) + { + let _ = self + .state_machine + .transition_to_lock_fee() + .and_then(|_| { + self.state_machine.transition_to_account_withdraw( + component_address, + ResourceSpecifier::Amount(resource_address, amount), + ) + }) + .map_err(|_| { + self.illegal_instruction_encountered = true; + }); + } else if let ( + ACCOUNT_LOCK_FEE_AND_WITHDRAW_NON_FUNGIBLES_IDENT, + Some(AccountLockFeeAndWithdrawNonFungiblesInput { + ids, + resource_address, + .. + }), + ) = (method_name, to_manifest_type(args)) + { + let _ = self + .state_machine + .transition_to_lock_fee() + .and_then(|_| { + self.state_machine.transition_to_account_withdraw( + component_address, + ResourceSpecifier::Ids(resource_address, ids), + ) + }) + .map_err(|_| { + self.illegal_instruction_encountered = true; + }); + } else if let (ACCOUNT_DEPOSIT_IDENT | ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, Ok(())) = ( + method_name, + validate_manifest_value_against_schema::(args), + ) { + let _ = self + .state_machine + .transition_to_deposit(component_address) + .map_err(|_| { + self.illegal_instruction_encountered = true; + }); + } else { + self.illegal_instruction_encountered = true; + } + } else { + self.illegal_instruction_encountered = true + } + + Ok(()) + } + + #[inline] + fn visit_take_from_worktop( + &mut self, + _: &ResourceAddress, + _: &Decimal, + ) -> Result<(), InstructionVisitorError> { + let _ = self + .state_machine + .transition_to_take_from_worktop() + .map_err(|_| { + self.illegal_instruction_encountered = true; + }); + + Ok(()) + } + + /* Illegal Instructions */ + + #[inline] + fn visit_take_all_from_worktop( + &mut self, + _: &ResourceAddress, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_take_non_fungibles_from_worktop( + &mut self, + _: &ResourceAddress, + _: &[NonFungibleLocalId], + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_return_to_worktop( + &mut self, + _: &ManifestBucket, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_assert_worktop_contains( + &mut self, + _: &ResourceAddress, + _: &Decimal, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_assert_worktop_contains_non_fungibles( + &mut self, + _: &ResourceAddress, + _: &[NonFungibleLocalId], + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_pop_from_auth_zone(&mut self) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_push_to_auth_zone( + &mut self, + _: &ManifestProof, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_clear_auth_zone(&mut self) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_create_proof_from_auth_zone_of_amount( + &mut self, + _: &ResourceAddress, + _: &Decimal, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_create_proof_from_auth_zone_of_non_fungibles( + &mut self, + _: &ResourceAddress, + _: &[NonFungibleLocalId], + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_create_proof_from_auth_zone_of_all( + &mut self, + _: &ResourceAddress, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_clear_signature_proofs(&mut self) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_create_proof_from_bucket_of_amount( + &mut self, + _: &ManifestBucket, + _: &Decimal, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_create_proof_from_bucket_of_non_fungibles( + &mut self, + _: &ManifestBucket, + _: &[NonFungibleLocalId], + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_create_proof_from_bucket_of_all( + &mut self, + _: &ManifestBucket, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_burn_resource(&mut self, _: &ManifestBucket) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_clone_proof(&mut self, _: &ManifestProof) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_drop_proof(&mut self, _: &ManifestProof) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_call_function( + &mut self, + _: &DynamicPackageAddress, + _: &str, + _: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_call_royalty_method( + &mut self, + _: &DynamicGlobalAddress, + _: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_call_metadata_method( + &mut self, + _: &DynamicGlobalAddress, + _: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_call_access_rules_method( + &mut self, + _: &DynamicGlobalAddress, + _: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_call_direct_vault_method( + &mut self, + _: &InternalAddress, + _: &str, + _: &ManifestValue, + ) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } + + #[inline] + fn visit_drop_all_proofs(&mut self) -> Result<(), InstructionVisitorError> { + self.illegal_instruction_encountered = true; + Ok(()) + } +} + +#[derive(Clone, Debug, Default)] +enum StateMachine { + #[default] + None, + LockFee, + AccountWithdraw(ComponentAddress, ResourceSpecifier), + TakeFromWorktop(ComponentAddress, ResourceSpecifier), + Deposit(ComponentAddress, ComponentAddress, ResourceSpecifier), +} + +impl StateMachine { + pub fn transition_to_lock_fee(&mut self) -> Result<(), StateMachineError> { + match self { + Self::None => { + *self = Self::LockFee; + Ok(()) + } + Self::LockFee + | Self::AccountWithdraw(..) + | Self::TakeFromWorktop(..) + | Self::Deposit(..) => Err(StateMachineError), + } + } + + pub fn transition_to_account_withdraw( + &mut self, + component_address: ComponentAddress, + resource_specifier: ResourceSpecifier, + ) -> Result<(), StateMachineError> { + match self { + Self::None | Self::LockFee => { + *self = Self::AccountWithdraw(component_address, resource_specifier); + Ok(()) + } + Self::AccountWithdraw(..) | Self::TakeFromWorktop(..) | Self::Deposit(..) => { + Err(StateMachineError) + } + } + } + + pub fn transition_to_take_from_worktop(&mut self) -> Result<(), StateMachineError> { + match self { + Self::AccountWithdraw(from_account, resources) => { + *self = Self::TakeFromWorktop(*from_account, resources.clone()); + Ok(()) + } + Self::None | Self::LockFee | Self::TakeFromWorktop(..) | Self::Deposit(..) => { + Err(StateMachineError) + } + } + } + + pub fn transition_to_deposit( + &mut self, + to_account: ComponentAddress, + ) -> Result<(), StateMachineError> { + match self { + Self::TakeFromWorktop(from_account, resources) => { + *self = Self::Deposit(*from_account, to_account, resources.clone()); + Ok(()) + } + Self::None | Self::LockFee | Self::Deposit(..) | Self::AccountWithdraw(..) => { + Err(StateMachineError) + } + } + } + + pub fn output( + self, + ) -> Result<(ComponentAddress, ComponentAddress, ResourceSpecifier), StateMachineError> { + match self { + Self::Deposit(from, to, resources) => Ok((from, to, resources)), + Self::None | Self::LockFee | Self::TakeFromWorktop(..) | Self::AccountWithdraw(..) => { + Err(StateMachineError) + } + } + } +} + +#[derive(Clone, Debug)] +pub struct StateMachineError; diff --git a/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/transfer_visitor.rs b/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/transfer_visitor.rs new file mode 100644 index 00000000..f3c0e24c --- /dev/null +++ b/radix-engine-toolkit-core/src/instruction_visitor/visitors/transaction_type/transfer_visitor.rs @@ -0,0 +1,508 @@ +// 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 transaction::{ + prelude::{DynamicGlobalAddress, InstructionV1}, + validation::ManifestIdAllocator, +}; + +use scrypto::blueprints::account::*; +use scrypto::prelude::*; + +use crate::{ + instruction_visitor::core::{error::InstructionVisitorError, traits::InstructionVisitor}, + sbor::indexed_manifest_value::IndexedManifestValue, + utils::{self, is_account, to_manifest_type}, +}; + +#[derive(Default, Clone, Debug)] +pub struct TransferTransactionTypeVisitor { + // Tracks the amount of resources currently in the worktop. + worktop: Worktop, + + // Tracks the contents of the bucket. + bucket_tracker: HashMap, + + // Tracks which accounts were withdrawn from. + account_withdrawn_from: Option, + + // Tracks the accounts deposited into and the quantity. + account_deposits: HashMap>, + + // Tracks if the visitor is currently in an illegal state or not. + is_illegal_state: bool, +} + +impl TransferTransactionTypeVisitor { + #[allow(clippy::type_complexity)] + pub fn output( + self, + ) -> Option<( + ComponentAddress, + HashMap>, + )> { + if self.is_illegal_state { + None + } else if self.account_withdrawn_from.is_some() && !self.account_deposits.is_empty() { + Some((self.account_withdrawn_from.unwrap(), self.account_deposits)) + } else { + None + } + } +} + +impl InstructionVisitor for TransferTransactionTypeVisitor { + fn is_enabled(&self) -> bool { + !self.is_illegal_state + } + + fn visit_instruction( + &mut self, + instruction: &InstructionV1, + ) -> Result<(), InstructionVisitorError> { + match instruction { + /* Method Calls */ + InstructionV1::CallMethod { + address: DynamicGlobalAddress::Static(address), + method_name, + args, + } => { + if !is_account(address) { + self.is_illegal_state = true; + return Ok(()); + } + + let component_address = ComponentAddress::new_or_panic(address.as_node_id().0); + + match method_name.as_str() { + ACCOUNT_WITHDRAW_IDENT => to_manifest_type(args) + .ok_or(TransferTransactionTypeError::InvalidArgs) + .and_then(|value| self.handle_account_withdraw(component_address, value))?, + ACCOUNT_WITHDRAW_NON_FUNGIBLES_IDENT => to_manifest_type(args) + .ok_or(TransferTransactionTypeError::InvalidArgs) + .and_then(|value| { + self.handle_account_withdraw_non_fungibles(component_address, value) + })?, + ACCOUNT_LOCK_FEE_AND_WITHDRAW_IDENT => to_manifest_type(args) + .ok_or(TransferTransactionTypeError::InvalidArgs) + .and_then(|value| { + self.handle_account_lock_fee_and_withdraw(component_address, value) + })?, + ACCOUNT_LOCK_FEE_AND_WITHDRAW_NON_FUNGIBLES_IDENT => to_manifest_type(args) + .ok_or(TransferTransactionTypeError::InvalidArgs) + .and_then(|value| { + self.handle_account_lock_fee_and_withdraw_non_fungibles( + component_address, + value, + ) + })?, + ACCOUNT_DEPOSIT_IDENT + | ACCOUNT_DEPOSIT_BATCH_IDENT + | ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT + | ACCOUNT_TRY_DEPOSIT_BATCH_OR_REFUND_IDENT => { + self.handle_validation_and_account_deposits(component_address, args)? + } + ACCOUNT_LOCK_FEE_IDENT => {} + _ => { + self.is_illegal_state = true; + } + }; + } + /* Worktop Take */ + InstructionV1::TakeFromWorktop { + resource_address, + amount, + } => { + let (bucket, resources) = self + .worktop + .take(*resource_address, *amount) + .map_err(TransferTransactionTypeError::WorktopError)?; + self.bucket_tracker + .insert(bucket, (*resource_address, resources)); + } + InstructionV1::TakeAllFromWorktop { resource_address } => { + let (bucket, resources) = self + .worktop + .take_all(*resource_address) + .map_err(TransferTransactionTypeError::WorktopError)?; + self.bucket_tracker + .insert(bucket, (*resource_address, resources)); + } + InstructionV1::TakeNonFungiblesFromWorktop { + resource_address, + ids, + } => { + let (bucket, resources) = self + .worktop + .take_non_fungibles(*resource_address, &ids.iter().cloned().collect()) + .map_err(TransferTransactionTypeError::WorktopError)?; + self.bucket_tracker + .insert(bucket, (*resource_address, resources)); + } + InstructionV1::ReturnToWorktop { bucket_id } => { + let (resource_address, resources) = self + .bucket_tracker + .remove(bucket_id) + .ok_or(TransferTransactionTypeError::BucketNotFound(*bucket_id))?; + self.worktop + .put(resource_address, resources) + .map_err(TransferTransactionTypeError::WorktopError)?; + } + /* Allowed Instructions */ + InstructionV1::AssertWorktopContains { .. } + | InstructionV1::AssertWorktopContainsAny { .. } + | InstructionV1::AssertWorktopContainsNonFungibles { .. } => {} + /* Illegal Instructions */ + InstructionV1::CallMethod { .. } + | InstructionV1::PopFromAuthZone + | InstructionV1::PushToAuthZone { .. } + | InstructionV1::ClearAuthZone + | InstructionV1::CreateProofFromAuthZoneOfAmount { .. } + | InstructionV1::CreateProofFromAuthZoneOfNonFungibles { .. } + | InstructionV1::CreateProofFromAuthZoneOfAll { .. } + | InstructionV1::ClearSignatureProofs + | InstructionV1::CreateProofFromBucketOfAmount { .. } + | InstructionV1::CreateProofFromBucketOfNonFungibles { .. } + | InstructionV1::CreateProofFromBucketOfAll { .. } + | InstructionV1::BurnResource { .. } + | InstructionV1::CloneProof { .. } + | InstructionV1::DropProof { .. } + | InstructionV1::CallFunction { .. } + | InstructionV1::CallRoyaltyMethod { .. } + | InstructionV1::CallMetadataMethod { .. } + | InstructionV1::CallAccessRulesMethod { .. } + | InstructionV1::CallDirectVaultMethod { .. } + | InstructionV1::DropAllProofs + | InstructionV1::AllocateGlobalAddress { .. } => { + self.is_illegal_state = true; + } + } + + Ok(()) + } +} + +impl TransferTransactionTypeVisitor { + fn handle_account_withdraw( + &mut self, + component_address: ComponentAddress, + AccountWithdrawInput { + resource_address, + amount, + }: AccountWithdrawInput, + ) -> Result<(), TransferTransactionTypeError> { + if let Some(account_withdrawn_from_in_the_past) = self.account_withdrawn_from { + if component_address != account_withdrawn_from_in_the_past { + self.is_illegal_state = true; + return Ok(()); + } + } else { + self.account_withdrawn_from = Some(component_address) + } + + self.worktop + .put(resource_address, Resources::Amount(amount))?; + Ok(()) + } + + fn handle_account_withdraw_non_fungibles( + &mut self, + component_address: ComponentAddress, + AccountWithdrawNonFungiblesInput { + resource_address, + ids, + }: AccountWithdrawNonFungiblesInput, + ) -> Result<(), TransferTransactionTypeError> { + if let Some(account_withdrawn_from_in_the_past) = self.account_withdrawn_from { + if component_address != account_withdrawn_from_in_the_past { + self.is_illegal_state = true; + return Ok(()); + } + } else { + self.account_withdrawn_from = Some(component_address) + } + + self.worktop.put(resource_address, Resources::Ids(ids))?; + Ok(()) + } + + fn handle_account_lock_fee_and_withdraw( + &mut self, + component_address: ComponentAddress, + AccountLockFeeAndWithdrawInput { + resource_address, + amount, + .. + }: AccountLockFeeAndWithdrawInput, + ) -> Result<(), TransferTransactionTypeError> { + self.handle_account_withdraw( + component_address, + AccountWithdrawInput { + resource_address, + amount, + }, + ) + } + + fn handle_account_lock_fee_and_withdraw_non_fungibles( + &mut self, + component_address: ComponentAddress, + AccountLockFeeAndWithdrawNonFungiblesInput { + resource_address, + ids, + .. + }: AccountLockFeeAndWithdrawNonFungiblesInput, + ) -> Result<(), TransferTransactionTypeError> { + self.handle_account_withdraw_non_fungibles( + component_address, + AccountWithdrawNonFungiblesInput { + resource_address, + ids, + }, + ) + } + + fn handle_validation_and_account_deposits( + &mut self, + component_address: ComponentAddress, + args: &ManifestValue, + ) -> Result<(), TransferTransactionTypeError> { + // Validate that this follows either the deposit or deposit bach schema. If it does, then + // extract all buckets and expressions and deal with them. + + let matches_deposit_schema = [ + utils::validate_manifest_value_against_schema::(args), + utils::validate_manifest_value_against_schema::(args), + ] + .into_iter() + .any(|result| result.is_ok()); + + if !matches_deposit_schema { + return Err(TransferTransactionTypeError::InvalidArgs); + } + + let indexed_manifest_value = IndexedManifestValue::from_manifest_value(args); + let buckets = indexed_manifest_value.buckets(); + let expressions = indexed_manifest_value.expressions(); + + let resources_to_deposit = if !buckets.is_empty() { + let mut vec = vec![]; + for bucket in buckets { + let (resource_address, resources) = self + .bucket_tracker + .remove(bucket) + .ok_or(TransferTransactionTypeError::BucketNotFound(*bucket))?; + + vec.push((resource_address, resources)) + } + Ok(vec) + } else if !expressions.is_empty() { + Ok(self.worktop.drain().collect()) + } else { + Err(TransferTransactionTypeError::InvalidArgs) + }?; + + for (resource_address, resources) in resources_to_deposit { + let deposits_map = self.account_deposits.entry(component_address).or_default(); + if let Some(deposited_resources) = deposits_map.get_mut(&resource_address) { + *deposited_resources = deposited_resources + .checked_add(&resources) + .ok_or(TransferTransactionTypeError::DepositError)?; + } else { + deposits_map.insert(resource_address, resources); + } + } + + Ok(()) + } +} + +#[derive(Default, Clone, Debug)] +pub struct Worktop { + id_allocator: ManifestIdAllocator, + worktop: HashMap, +} + +impl Worktop { + fn take_all( + &mut self, + resource_address: ResourceAddress, + ) -> Result<(ManifestBucket, Resources), WorktopError> { + self.worktop + .remove(&resource_address) + .map(|resources| { + let bucket = self.id_allocator.new_bucket_id(); + (bucket, resources) + }) + .map_or( + Err(WorktopError::ResourceNotOnWorktop(resource_address)), + Ok, + ) + } + + fn take( + &mut self, + resource_address: ResourceAddress, + amount: Decimal, + ) -> Result<(ManifestBucket, Resources), WorktopError> { + let worktop_contents = + self.worktop + .get_mut(&resource_address) + .ok_or(WorktopError::ContentValidationError( + resource_address, + Resources::Amount(amount), + ))?; + + let bucket = self.id_allocator.new_bucket_id(); + let resources = match worktop_contents { + Resources::Amount(worktop_amount) => { + if *worktop_amount >= amount { + *worktop_amount -= amount; + Ok(Resources::Amount(amount)) + } else { + Err(WorktopError::TakeError) + } + } + Resources::Ids(worktop_ids) => { + let amount_to_take = amount + .to_string() + .parse::() + .map_err(|_| WorktopError::NonFungiblesCanNotBeFractionalized)?; + + if worktop_ids.len() >= amount_to_take { + let ids_to_take = worktop_ids + .iter() + .take(amount_to_take) + .cloned() + .collect::>(); + for id in ids_to_take.iter() { + worktop_ids.remove(id); + } + Ok(Resources::Ids(ids_to_take)) + } else { + Err(WorktopError::TakeError) + } + } + }?; + + Ok((bucket, resources)) + } + + fn take_non_fungibles( + &mut self, + resource_address: ResourceAddress, + ids: &BTreeSet, + ) -> Result<(ManifestBucket, Resources), WorktopError> { + let worktop_contents = + self.worktop + .get_mut(&resource_address) + .ok_or(WorktopError::ContentValidationError( + resource_address, + Resources::Ids(ids.clone()), + ))?; + + *worktop_contents = worktop_contents + .checked_sub_ids(ids) + .ok_or(WorktopError::TakeError)?; + + let bucket = self.id_allocator.new_bucket_id(); + let resources = Resources::Ids(ids.clone()); + + Ok((bucket, resources)) + } + + fn put( + &mut self, + resource_address: ResourceAddress, + resources: Resources, + ) -> Result<(), WorktopError> { + if let Some(worktop_contents) = self.worktop.get_mut(&resource_address) { + *worktop_contents = worktop_contents + .checked_add(&resources) + .ok_or(WorktopError::PutError)?; + } else { + self.worktop.insert(resource_address, resources); + }; + + Ok(()) + } + + fn drain(&mut self) -> std::collections::hash_map::Drain { + self.worktop.drain() + } +} + +#[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq)] +pub enum Resources { + Amount(Decimal), + Ids(BTreeSet), +} + +impl Resources { + fn checked_add(&self, other: &Self) -> Option { + match (self, other) { + (Self::Amount(amount1), Self::Amount(amount2)) => { + Some(Self::Amount(*amount1 + *amount2)) + } + (Self::Ids(ids1), Self::Ids(ids2)) => Some(Self::Ids({ + let mut ids = ids1.clone(); + ids.extend(ids2.clone()); + ids + })), + _ => None, + } + } + + fn checked_sub_ids(&self, other: &BTreeSet) -> Option { + match self { + Self::Ids(ids) => { + let mut ids = ids.clone(); + for id in other { + if !ids.remove(id) { + return None; + } + } + + Some(Self::Ids(ids)) + } + Self::Amount(..) => None, + } + } +} + +#[derive(Debug, Clone)] +pub enum TransferTransactionTypeError { + InvalidArgs, + DepositError, + WorktopError(WorktopError), + BucketNotFound(ManifestBucket), +} + +#[derive(Debug, Clone)] +pub enum WorktopError { + PutError, + TakeError, + ResourceNotOnWorktop(ResourceAddress), + ContentValidationError(ResourceAddress, Resources), + NonFungiblesCanNotBeFractionalized, +} + +impl From for TransferTransactionTypeError { + fn from(value: WorktopError) -> Self { + Self::WorktopError(value) + } +} diff --git a/cli-json-interface/src/subcommands/mod.rs b/radix-engine-toolkit-core/src/lib.rs similarity index 89% rename from cli-json-interface/src/subcommands/mod.rs rename to radix-engine-toolkit-core/src/lib.rs index cf8bf7c1..13ad2875 100644 --- a/cli-json-interface/src/subcommands/mod.rs +++ b/radix-engine-toolkit-core/src/lib.rs @@ -5,9 +5,9 @@ // 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 @@ -15,7 +15,9 @@ // specific language governing permissions and limitations // under the License. -pub mod address; +pub mod functions; +pub mod instruction_visitor; pub mod sbor; -pub mod transaction; +pub mod schema_visitor; +pub mod statics; pub mod utils; diff --git a/radix-engine-toolkit-core/src/sbor/indexed_manifest_value.rs b/radix-engine-toolkit-core/src/sbor/indexed_manifest_value.rs new file mode 100644 index 00000000..125a5357 --- /dev/null +++ b/radix-engine-toolkit-core/src/sbor/indexed_manifest_value.rs @@ -0,0 +1,161 @@ +// 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 core::cell::RefCell; +use radix_engine_common::data::manifest::*; +use radix_engine_common::types::*; +use sbor::rust::cell::Ref; +use sbor::rust::prelude::*; +use sbor::traversal::*; +use sbor::*; +use transaction::prelude::{ManifestAddress, ManifestBucket, ManifestExpression}; + +#[derive(Clone, PartialEq, Eq)] +pub struct IndexedManifestValue { + bytes: Vec, + manifest_value: RefCell>, + + static_addresses: Vec, + named_addresses: Vec, + buckets: Vec, + expressions: Vec, +} + +impl IndexedManifestValue { + fn new(bytes: Vec) -> Result { + let mut traverser = ManifestTraverser::new( + &bytes, + MANIFEST_SBOR_V1_MAX_DEPTH, + ExpectedStart::PayloadPrefix(MANIFEST_SBOR_V1_PAYLOAD_PREFIX), + true, + ); + let mut static_addresses = Vec::new(); + let mut named_addresses = Vec::new(); + let mut buckets = Vec::new(); + let mut expressions = Vec::new(); + loop { + let event = traverser.next_event(); + match event.event { + TraversalEvent::ContainerStart(_) => {} + TraversalEvent::ContainerEnd(_) => {} + TraversalEvent::TerminalValue(r) => { + if let traversal::TerminalValueRef::Custom(c) = r { + match c.0 { + ManifestCustomValue::Address(address) => match address { + ManifestAddress::Static(node_id) => static_addresses.push(node_id), + ManifestAddress::Named(id) => named_addresses.push(id), + }, + ManifestCustomValue::Bucket(bucket) => buckets.push(bucket), + ManifestCustomValue::Expression(expression) => { + expressions.push(expression) + } + ManifestCustomValue::Proof(_) + | ManifestCustomValue::Blob(_) + | ManifestCustomValue::Decimal(_) + | ManifestCustomValue::PreciseDecimal(_) + | ManifestCustomValue::NonFungibleLocalId(_) + | ManifestCustomValue::AddressReservation(_) => {} + } + } + } + TraversalEvent::TerminalValueBatch(_) => {} + TraversalEvent::End => { + break; + } + TraversalEvent::DecodeError(e) => { + return Err(e); + } + } + } + + Ok(Self { + bytes, + static_addresses, + named_addresses, + buckets, + expressions, + manifest_value: RefCell::new(None), + }) + } + + fn get_manifest_value(&self) -> Ref { + let is_empty = { self.manifest_value.borrow().is_none() }; + + if is_empty { + *self.manifest_value.borrow_mut() = Some( + manifest_decode::(&self.bytes) + .expect("Failed to decode bytes in IndexedManifestValue"), + ); + } + + Ref::map(self.manifest_value.borrow(), |v| v.as_ref().unwrap()) + } + + pub fn unit() -> Self { + Self::from_typed(&()) + } + + pub fn from_typed(value: &T) -> Self { + let bytes = manifest_encode(value).expect("Failed to encode trusted Rust value"); + Self::new(bytes).expect("Failed to index trusted Rust value") + } + + pub fn from_manifest_value(value: &ManifestValue) -> Self { + let bytes = manifest_encode(value).expect("Failed to encode trusted ManifestValue"); + Self::new(bytes).expect("Failed to index trusted ManifestValue") + } + + pub fn from_slice(slice: &[u8]) -> Result { + Self::new(slice.to_vec()) + } + + pub fn from_vec(vec: Vec) -> Result { + Self::new(vec) + } + + pub fn to_manifest_value(&self) -> ManifestValue { + self.get_manifest_value().clone() + } + + pub fn as_manifest_value(&self) -> Ref { + self.get_manifest_value() + } + + pub fn as_typed(&self) -> Result { + manifest_decode(&self.bytes) + } + + pub fn as_slice(&self) -> &[u8] { + self.bytes.as_slice() + } + + pub fn static_addresses(&self) -> &Vec { + &self.static_addresses + } + + pub fn named_addresses(&self) -> &Vec { + &self.named_addresses + } + + pub fn expressions(&self) -> &Vec { + &self.expressions + } + + pub fn buckets(&self) -> &Vec { + &self.buckets + } +} diff --git a/radix-engine-toolkit/src/model/value/manifest_sbor/mod.rs b/radix-engine-toolkit-core/src/sbor/mod.rs similarity index 92% rename from radix-engine-toolkit/src/model/value/manifest_sbor/mod.rs rename to radix-engine-toolkit-core/src/sbor/mod.rs index d592a121..45422309 100644 --- a/radix-engine-toolkit/src/model/value/manifest_sbor/mod.rs +++ b/radix-engine-toolkit-core/src/sbor/mod.rs @@ -15,8 +15,4 @@ // specific language governing permissions and limitations // under the License. -pub mod bridge; -pub mod model; - -pub use bridge::*; -pub use model::*; +pub mod indexed_manifest_value; diff --git a/radix-engine-toolkit-core/src/schema_visitor/core/error.rs b/radix-engine-toolkit-core/src/schema_visitor/core/error.rs new file mode 100644 index 00000000..b2f76dfb --- /dev/null +++ b/radix-engine-toolkit-core/src/schema_visitor/core/error.rs @@ -0,0 +1,31 @@ +// 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 sbor::LocalTypeIndex; +use std::convert::Infallible; + +#[derive(Debug, Clone)] +pub enum SchemaVisitorError { + Infallible(Infallible), + InvalidLocalTypeIndex(LocalTypeIndex), +} + +impl From for SchemaVisitorError { + fn from(error: Infallible) -> Self { + Self::Infallible(error) + } +} diff --git a/radix-engine-toolkit-core/src/schema_visitor/core/mod.rs b/radix-engine-toolkit-core/src/schema_visitor/core/mod.rs new file mode 100644 index 00000000..bfd035d1 --- /dev/null +++ b/radix-engine-toolkit-core/src/schema_visitor/core/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 error; +pub mod traits; +pub mod traverser; diff --git a/radix-engine-toolkit-core/src/schema_visitor/core/traits.rs b/radix-engine-toolkit-core/src/schema_visitor/core/traits.rs new file mode 100644 index 00000000..240ab167 --- /dev/null +++ b/radix-engine-toolkit-core/src/schema_visitor/core/traits.rs @@ -0,0 +1,195 @@ +// 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 sbor::{CustomSchema, LocalTypeIndex, Schema}; +use std::fmt::Debug; + +#[allow(unused_variables)] +pub trait SchemaVisitor +where + T: CustomSchema, +{ + type Error: Debug + Into; + + #[inline] + fn visit_any( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_bool( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_i8( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_i16( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_i32( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_i64( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_i128( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_u8( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_u16( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_u32( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_u64( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_u128( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_string( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_array( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_tuple( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_enum( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_map( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn visit_custom( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + custom_type_kind: &T::CustomTypeKind, + ) -> Result<(), Self::Error> { + Ok(()) + } + + #[inline] + fn is_enabled(&self) -> bool { + true + } +} diff --git a/radix-engine-toolkit-core/src/schema_visitor/core/traverser.rs b/radix-engine-toolkit-core/src/schema_visitor/core/traverser.rs new file mode 100644 index 00000000..18b520be --- /dev/null +++ b/radix-engine-toolkit-core/src/schema_visitor/core/traverser.rs @@ -0,0 +1,120 @@ +// 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::{error::SchemaVisitorError, traits::SchemaVisitor}; +use sbor::{CustomSchema, LocalTypeIndex, Schema, SchemaTypeKind}; +use std::fmt::Debug; + +pub fn traverse( + schema: &Schema, + local_type_index: LocalTypeIndex, + visitors: &mut [&mut dyn SchemaVisitor>], +) -> Result<(), SchemaVisitorError> +where + T: CustomSchema, +{ + let type_kind = schema.resolve_type_kind(local_type_index).map_or( + Err(SchemaVisitorError::InvalidLocalTypeIndex(local_type_index)), + Ok, + )?; + + match type_kind { + SchemaTypeKind::::Any => { + for_each_enabled_visitor!(visitors, visit_any(local_type_index, schema)) + } + SchemaTypeKind::::Bool => { + for_each_enabled_visitor!(visitors, visit_bool(local_type_index, schema)) + } + SchemaTypeKind::::I8 => { + for_each_enabled_visitor!(visitors, visit_i8(local_type_index, schema)) + } + SchemaTypeKind::::I16 => { + for_each_enabled_visitor!(visitors, visit_i16(local_type_index, schema)) + } + SchemaTypeKind::::I32 => { + for_each_enabled_visitor!(visitors, visit_i32(local_type_index, schema)) + } + SchemaTypeKind::::I64 => { + for_each_enabled_visitor!(visitors, visit_i64(local_type_index, schema)) + } + SchemaTypeKind::::I128 => { + for_each_enabled_visitor!(visitors, visit_i128(local_type_index, schema)) + } + SchemaTypeKind::::U8 => { + for_each_enabled_visitor!(visitors, visit_u8(local_type_index, schema)) + } + SchemaTypeKind::::U16 => { + for_each_enabled_visitor!(visitors, visit_u16(local_type_index, schema)) + } + SchemaTypeKind::::U32 => { + for_each_enabled_visitor!(visitors, visit_u32(local_type_index, schema)) + } + SchemaTypeKind::::U64 => { + for_each_enabled_visitor!(visitors, visit_u64(local_type_index, schema)) + } + SchemaTypeKind::::U128 => { + for_each_enabled_visitor!(visitors, visit_u128(local_type_index, schema)) + } + SchemaTypeKind::::String => { + for_each_enabled_visitor!(visitors, visit_string(local_type_index, schema)) + } + SchemaTypeKind::::Array { element_type } => { + for_each_enabled_visitor!(visitors, visit_array(local_type_index, schema)); + traverse(schema, *element_type, visitors)?; + } + SchemaTypeKind::::Tuple { field_types } => { + for_each_enabled_visitor!(visitors, visit_tuple(local_type_index, schema)); + for local_type_index in field_types { + traverse(schema, *local_type_index, visitors)?; + } + } + SchemaTypeKind::::Enum { variants } => { + for_each_enabled_visitor!(visitors, visit_enum(local_type_index, schema)); + for local_type_indices in variants.values() { + for local_type_index in local_type_indices { + traverse(schema, *local_type_index, visitors)?; + } + } + } + SchemaTypeKind::::Map { + key_type, + value_type, + } => { + for_each_enabled_visitor!(visitors, visit_map(local_type_index, schema)); + traverse(schema, *key_type, visitors)?; + traverse(schema, *value_type, visitors)?; + } + SchemaTypeKind::::Custom(custom) => { + for_each_enabled_visitor!(visitors, visit_custom(local_type_index, schema, custom)); + } + }; + + Ok(()) +} + +macro_rules! for_each_enabled_visitor { + ($visitors: expr, $method_ident: ident ( $($arg: ident),* $(,)? )) => { + for visitor in $visitors.iter_mut() { + if visitor.is_enabled() { + visitor.$method_ident( + $($arg),* + ).map_err(Into::into)?; + } + } + }; +} +use for_each_enabled_visitor; diff --git a/radix-engine-toolkit-core/src/schema_visitor/mod.rs b/radix-engine-toolkit-core/src/schema_visitor/mod.rs new file mode 100644 index 00000000..1da3cb39 --- /dev/null +++ b/radix-engine-toolkit-core/src/schema_visitor/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 core; +pub mod visitors; diff --git a/radix-engine-toolkit-core/src/schema_visitor/visitors/bucket_in_path_visitor.rs b/radix-engine-toolkit-core/src/schema_visitor/visitors/bucket_in_path_visitor.rs new file mode 100644 index 00000000..3a8ae233 --- /dev/null +++ b/radix-engine-toolkit-core/src/schema_visitor/visitors/bucket_in_path_visitor.rs @@ -0,0 +1,65 @@ +// 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::schema_visitor::core::{error::SchemaVisitorError, traits::SchemaVisitor}; +use radix_engine_common::prelude::{ + OwnValidation, ScryptoCustomSchema, ScryptoCustomTypeKind, ScryptoCustomTypeValidation, +}; +use sbor::{LocalTypeIndex, Schema, TypeValidation}; + +#[derive(Default)] +pub struct BucketInPathVisitor(bool); + +impl SchemaVisitor for BucketInPathVisitor { + type Error = SchemaVisitorError; + + fn visit_custom( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + custom_type_kind: &::CustomTypeKind< + LocalTypeIndex, + >, + ) -> Result<(), Self::Error> { + let type_validation = schema.resolve_type_validation(local_type_index).map_or( + Err(SchemaVisitorError::InvalidLocalTypeIndex(local_type_index)), + Ok, + )?; + if *custom_type_kind == ScryptoCustomTypeKind::Own + && matches!( + type_validation, + TypeValidation::::Custom( + ScryptoCustomTypeValidation::Own(OwnValidation::IsBucket), + ) + ) + { + self.0 = true + } + + Ok(()) + } + + fn is_enabled(&self) -> bool { + !self.0 + } +} + +impl BucketInPathVisitor { + pub fn path_contains_bucket(self) -> bool { + self.0 + } +} diff --git a/radix-engine-toolkit-core/src/schema_visitor/visitors/mod.rs b/radix-engine-toolkit-core/src/schema_visitor/visitors/mod.rs new file mode 100644 index 00000000..16fee622 --- /dev/null +++ b/radix-engine-toolkit-core/src/schema_visitor/visitors/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 bucket_in_path_visitor; +pub mod proof_in_path_visitor; diff --git a/radix-engine-toolkit-core/src/schema_visitor/visitors/proof_in_path_visitor.rs b/radix-engine-toolkit-core/src/schema_visitor/visitors/proof_in_path_visitor.rs new file mode 100644 index 00000000..73b62a72 --- /dev/null +++ b/radix-engine-toolkit-core/src/schema_visitor/visitors/proof_in_path_visitor.rs @@ -0,0 +1,65 @@ +// 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::schema_visitor::core::{error::SchemaVisitorError, traits::SchemaVisitor}; +use radix_engine_common::prelude::{ + OwnValidation, ScryptoCustomSchema, ScryptoCustomTypeKind, ScryptoCustomTypeValidation, +}; +use sbor::{LocalTypeIndex, Schema, TypeValidation}; + +#[derive(Default)] +pub struct ProofInPathVisitor(bool); + +impl SchemaVisitor for ProofInPathVisitor { + type Error = SchemaVisitorError; + + fn visit_custom( + &mut self, + local_type_index: LocalTypeIndex, + schema: &Schema, + custom_type_kind: &::CustomTypeKind< + LocalTypeIndex, + >, + ) -> Result<(), Self::Error> { + let type_validation = schema.resolve_type_validation(local_type_index).map_or( + Err(SchemaVisitorError::InvalidLocalTypeIndex(local_type_index)), + Ok, + )?; + if *custom_type_kind == ScryptoCustomTypeKind::Own + && matches!( + type_validation, + TypeValidation::::Custom( + ScryptoCustomTypeValidation::Own(OwnValidation::IsProof), + ) + ) + { + self.0 = true + } + + Ok(()) + } + + fn is_enabled(&self) -> bool { + !self.0 + } +} + +impl ProofInPathVisitor { + pub fn path_contains_proof(self) -> bool { + self.0 + } +} diff --git a/radix-engine-toolkit-core/src/statics.rs b/radix-engine-toolkit-core/src/statics.rs new file mode 100644 index 00000000..0e4d4efa --- /dev/null +++ b/radix-engine-toolkit-core/src/statics.rs @@ -0,0 +1,236 @@ +// 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 lazy_static::lazy_static; +use radix_engine::blueprints::native_schema::*; +use radix_engine::blueprints::package::*; +use radix_engine::types::*; +use scrypto::api::node_modules::auth::*; +use scrypto::api::node_modules::royalty::*; +use scrypto::blueprints::account::*; +use scrypto::blueprints::identity::*; + +use crate::schema_visitor::core::traverser::traverse; +use crate::schema_visitor::visitors::bucket_in_path_visitor::BucketInPathVisitor; +use crate::schema_visitor::visitors::proof_in_path_visitor::ProofInPathVisitor; + +lazy_static! { + // Account package + pub static ref ACCOUNT_BLUEPRINT_SCHEMA: BlueprintDefinitionInit = account_blueprint_schema(); + + pub static ref ACCOUNT_METHODS_THAT_REQUIRE_AUTH: Vec = account_methods_that_require_auth(); + + pub static ref ACCOUNT_DEPOSIT_METHODS: Vec = account_deposit_methods(); + + pub static ref ACCOUNT_WITHDRAW_METHODS: Vec = account_withdraw_methods(); + + pub static ref ACCOUNT_PROOF_CREATION_METHODS: Vec = account_proof_creation_methods(); + + // Identity Package + pub static ref IDENTITY_BLUEPRINT_SCHEMA: BlueprintDefinitionInit = identity_blueprint_schema(); + + pub static ref IDENTITY_METHODS_THAT_REQUIRE_AUTH: Vec = identity_methods_that_require_auth(); + + // Modules Package + pub static ref ACCESS_RULES_BLUEPRINT_SCHEMA: BlueprintDefinitionInit = access_rules_blueprint_schema(); + pub static ref METADATA_BLUEPRINT_SCHEMA: BlueprintDefinitionInit = metadata_blueprint_schema(); + pub static ref ROYALTY_BLUEPRINT_SCHEMA: BlueprintDefinitionInit = royalty_blueprint_schema(); + + pub static ref ACCESS_RULES_METHODS_THAT_REQUIRE_AUTH: Vec = access_rules_methods_that_require_auth(); + pub static ref METADATA_METHODS_THAT_REQUIRE_AUTH: Vec = metadata_methods_that_require_auth(); + pub static ref ROYALTY_METHODS_THAT_REQUIRE_AUTH: Vec = royalty_methods_that_require_auth(); +} + +fn account_blueprint_schema() -> BlueprintDefinitionInit { + ACCOUNT_PACKAGE_DEFINITION + .blueprints + .get(ACCOUNT_BLUEPRINT) + .unwrap() + .clone() +} + +fn account_methods_that_require_auth() -> Vec { + methods_that_require_auth(&ACCOUNT_BLUEPRINT_SCHEMA) +} + +fn account_deposit_methods() -> Vec { + ACCOUNT_BLUEPRINT_SCHEMA + .schema + .functions + .functions + .iter() + .filter_map(|(function_ident, function_schema)| { + // A function that doesn't have a mutable reference to self can not be a withdraw + // method + if function_schema.receiver != Some(ReceiverInfo::normal_ref_mut()) { + return None; + } + + let local_type_index = type_ref_static_or_panic(&function_schema.input); + if path_contains_a_bucket(*local_type_index, &ACCOUNT_BLUEPRINT_SCHEMA.schema.schema) { + Some(function_ident.to_owned()) + } else { + None + } + }) + .collect::>() +} + +fn account_withdraw_methods() -> Vec { + ACCOUNT_BLUEPRINT_SCHEMA + .schema + .functions + .functions + .iter() + .filter_map(|(function_ident, function_schema)| { + if function_schema.receiver != Some(ReceiverInfo::normal_ref_mut()) { + return None; + } + + if function_ident == ACCOUNT_SECURIFY_IDENT { + return None; + } + + if path_contains_a_bucket( + *type_ref_static_or_panic(&function_schema.output), + &ACCOUNT_BLUEPRINT_SCHEMA.schema.schema, + ) && !path_contains_a_bucket( + *type_ref_static_or_panic(&function_schema.input), + &ACCOUNT_BLUEPRINT_SCHEMA.schema.schema, + ) { + Some(function_ident.to_owned()) + } else { + None + } + }) + .collect::>() +} + +fn account_proof_creation_methods() -> Vec { + ACCOUNT_BLUEPRINT_SCHEMA + .schema + .functions + .functions + .iter() + .filter_map(|(function_ident, function_schema)| { + if function_schema.receiver != Some(ReceiverInfo::normal_ref()) { + return None; + } + + if path_contains_a_proof( + *type_ref_static_or_panic(&function_schema.output), + &ACCOUNT_BLUEPRINT_SCHEMA.schema.schema, + ) { + Some(function_ident.to_owned()) + } else { + None + } + }) + .collect::>() +} + +fn path_contains_a_bucket( + local_type_index: LocalTypeIndex, + schema: &Schema, +) -> bool { + let mut visitor = BucketInPathVisitor::default(); + traverse(schema, local_type_index, &mut [&mut visitor]).unwrap(); + visitor.path_contains_bucket() +} + +fn path_contains_a_proof( + local_type_index: LocalTypeIndex, + schema: &Schema, +) -> bool { + let mut visitor = ProofInPathVisitor::default(); + traverse(schema, local_type_index, &mut [&mut visitor]).unwrap(); + visitor.path_contains_proof() +} + +fn identity_blueprint_schema() -> BlueprintDefinitionInit { + IDENTITY_PACKAGE_DEFINITION + .blueprints + .get(IDENTITY_BLUEPRINT) + .unwrap() + .clone() +} + +fn identity_methods_that_require_auth() -> Vec { + methods_that_require_auth(&IDENTITY_BLUEPRINT_SCHEMA) +} + +fn access_rules_blueprint_schema() -> BlueprintDefinitionInit { + ACCESS_RULES_PACKAGE_DEFINITION + .blueprints + .get(ACCESS_RULES_BLUEPRINT) + .unwrap() + .clone() +} + +fn metadata_blueprint_schema() -> BlueprintDefinitionInit { + METADATA_PACKAGE_DEFINITION + .blueprints + .get(METADATA_BLUEPRINT) + .unwrap() + .clone() +} + +fn royalty_blueprint_schema() -> BlueprintDefinitionInit { + ROYALTIES_PACKAGE_DEFINITION + .blueprints + .get(COMPONENT_ROYALTY_BLUEPRINT) + .unwrap() + .clone() +} + +fn access_rules_methods_that_require_auth() -> Vec { + methods_that_require_auth(&ACCESS_RULES_BLUEPRINT_SCHEMA) +} + +fn metadata_methods_that_require_auth() -> Vec { + methods_that_require_auth(&METADATA_BLUEPRINT_SCHEMA) +} + +fn royalty_methods_that_require_auth() -> Vec { + methods_that_require_auth(&ROYALTY_BLUEPRINT_SCHEMA) +} + +fn methods_that_require_auth(blueprint_schema: &BlueprintDefinitionInit) -> Vec { + if let MethodAuthTemplate::StaticRoles(StaticRoles { ref methods, .. }) = + blueprint_schema.auth_config.method_auth + { + methods + .iter() + .filter_map(|(key, value)| { + if let MethodAccessibility::Public = value { + None + } else { + Some(key.clone()) + } + }) + .collect() + } else { + vec![] + } +} + +fn type_ref_static_or_panic(type_ref: &TypeRef) -> &T { + match type_ref { + TypeRef::Static(item) => item, + TypeRef::Generic(_) => panic!("TypeRef is not static!"), + } +} diff --git a/radix-engine-toolkit-core/src/utils.rs b/radix-engine-toolkit-core/src/utils.rs new file mode 100644 index 00000000..5945b518 --- /dev/null +++ b/radix-engine-toolkit-core/src/utils.rs @@ -0,0 +1,345 @@ +// 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::system::system::DynSubstate; +use radix_engine::transaction::TransactionReceipt; +use radix_engine_common::prelude::NetworkDefinition; +use radix_engine_queries::typed_substate_layout::{ + to_typed_substate_key, to_typed_substate_value, TypedMainModuleSubstateKey, + TypedMainModuleSubstateValue, TypedMetadataModuleSubstateKey, TypedMetadataModuleSubstateValue, + TypedSubstateKey, TypedSubstateValue, +}; +use radix_engine_store_interface::interface::DatabaseUpdate; +use regex::Regex; +use sbor::{generate_full_schema_from_single_type, validate_payload_against_schema}; +use scrypto::{api::node_modules::metadata::MetadataValue, prelude::*}; +use transaction::model::IntentV1; +use transaction::prelude::{DynamicGlobalAddress, TransactionManifestV1}; + +pub fn manifest_from_intent(intent: &IntentV1) -> TransactionManifestV1 { + let IntentV1 { + instructions, + blobs, + .. + } = intent; + TransactionManifestV1 { + instructions: instructions.0.clone(), + blobs: blobs + .blobs + .iter() + .map(|blob| (hash(&blob.0), blob.0.clone())) + .collect(), + } +} + +pub fn network_definition_from_network_id(network_id: u8) -> NetworkDefinition { + match network_id { + // Public facing networks + 0x01 => NetworkDefinition::mainnet(), + 0x02 => NetworkDefinition { + id: network_id, + logical_name: "stokenet".to_string(), + hrp_suffix: "tdx_2_".to_string(), + }, + + // Babylon Temporary Testnets + 0x0A => NetworkDefinition::adapanet(), + 0x0B => NetworkDefinition::nebunet(), + 0x0C => NetworkDefinition { + id: network_id, + logical_name: "kisharnet".to_string(), + hrp_suffix: "tdx_c_".to_string(), + }, + 0x0D => NetworkDefinition { + id: network_id, + logical_name: "ansharnet".to_string(), + hrp_suffix: "tdx_d_".to_string(), + }, + + // RDX Works Development + 0x20 => NetworkDefinition { + id: 0x20, + logical_name: "gilganet".to_string(), + hrp_suffix: "tdx_20_".to_string(), + }, + 0x21 => NetworkDefinition { + id: 0x21, + logical_name: "enkinet".to_string(), + hrp_suffix: "tdx_21_".to_string(), + }, + 0x22 => NetworkDefinition { + id: 0x22, + logical_name: "hammunet".to_string(), + hrp_suffix: "tdx_22_".to_string(), + }, + 0x23 => NetworkDefinition { + id: 0x23, + logical_name: "nergalnet".to_string(), + hrp_suffix: "tdx_23_".to_string(), + }, + 0x24 => NetworkDefinition { + id: 0x24, + logical_name: "mardunet".to_string(), + hrp_suffix: "tdx_24_".to_string(), + }, + 0x25 => NetworkDefinition { + id: 0x25, + logical_name: "dumunet".to_string(), + hrp_suffix: "tdx_25_".to_string(), + }, + + // Ephemeral Networks + 0xF0 => NetworkDefinition { + id: 240, + logical_name: "localnet".to_string(), + hrp_suffix: "loc".to_string(), + }, + 0xF1 => NetworkDefinition { + id: 241, + logical_name: "inttestnet".to_string(), + hrp_suffix: "test".to_string(), + }, + 0xF2 => NetworkDefinition::simulator(), + + // Unnamed + network_id => NetworkDefinition { + id: 0x25, + logical_name: "unnamed".to_string(), + hrp_suffix: format!("tdx_{:x}_", network_id), + }, + } +} + +pub fn network_id_from_hrp>(hrp: S) -> Option { + let network_specifier = { + let re = Regex::new("_(sim|loc|rdx|test|tdx_[A-Fa-f0-9]{1,2}_)$") + .expect("Failed to create Regex. Must panic"); + re.captures(hrp.as_ref()) + .and_then(|captures| captures.get(1)) + .map(|capture| capture.as_str().trim_end_matches('_')) + }; + + match network_specifier { + Some("rdx") => Some(0x01), + Some("loc") => Some(0xF0), + Some("test") => Some(0xF1), + Some("sim") => Some(0xF2), + Some(numeric_network_specifier) => { + if let Some(network_id_string) = numeric_network_specifier.split('_').nth(1) { + if let Ok(num) = u8::from_str_radix(network_id_string, 16) { + Some(num) + } else { + None + } + } else { + None + } + } + None => None, + } +} + +pub fn network_id_from_address_string>(address: S) -> Option { + if let Ok((hrp, ..)) = bech32::decode(address.as_ref()) { + network_id_from_hrp(hrp) + } else { + None + } +} + +pub fn to_manifest_type(value: &ManifestValue) -> Option { + manifest_encode(value) + .ok() + .and_then(|encoded| manifest_decode(&encoded).ok()) +} + +#[allow(clippy::result_unit_err)] +pub fn validate_manifest_value_against_schema( + value: &ManifestValue, +) -> Result<(), ()> { + let (local_type_index, schema) = + generate_full_schema_from_single_type::(); + let encoded_payload = manifest_encode(&value).unwrap(); + validate_payload_against_schema::( + &encoded_payload, + &schema, + local_type_index, + &(), + ) + .map_err(|_| ()) +} + +pub fn is_account + Clone>(node_id: &A) -> bool { + match node_id.clone().into() { + DynamicGlobalAddress::Named(_) => false, + DynamicGlobalAddress::Static(address) => { + matches!( + address.as_node_id().entity_type(), + Some( + EntityType::GlobalAccount + | EntityType::InternalAccount + | EntityType::GlobalVirtualSecp256k1Account + | EntityType::GlobalVirtualEd25519Account + ) + ) + } + } +} + +pub fn is_identity + Clone>(node_id: &A) -> bool { + match node_id.clone().into() { + DynamicGlobalAddress::Named(_) => false, + DynamicGlobalAddress::Static(address) => { + matches!( + address.as_node_id().entity_type(), + Some( + EntityType::GlobalIdentity + | EntityType::GlobalVirtualSecp256k1Identity + | EntityType::GlobalVirtualEd25519Identity + ) + ) + } + } +} + +pub fn metadata_of_newly_created_entities( + receipt: &TransactionReceipt, +) -> Option>> { + if !receipt.is_commit_success() { + return None; + } + + let mut map = HashMap::>::new(); + let commit_success = receipt.expect_commit_success(); + for global_address in commit_success + .new_component_addresses() + .iter() + .map(|address| address.into_node_id()) + .chain( + commit_success + .new_package_addresses() + .iter() + .map(|address| address.into_node_id()), + ) + .chain( + commit_success + .new_resource_addresses() + .iter() + .map(|address| address.into_node_id()), + ) + .map(|node_id| GlobalAddress::new_or_panic(node_id.0)) + { + if let Some(key_update_map) = commit_success + .state_updates + .system_updates + .get(&(*global_address.as_node_id(), METADATA_KV_STORE_PARTITION)) + { + for (substate_key, database_update) in key_update_map.iter() { + if let DatabaseUpdate::Set(data) = database_update { + if let Ok(( + TypedSubstateKey::MetadataModule(key), + TypedSubstateValue::MetadataModule(value), + )) = to_typed_substate_key( + global_address.as_node_id().entity_type().unwrap(), + METADATA_KV_STORE_PARTITION, + substate_key, + ) + .and_then(|typed_substate_key| { + to_typed_substate_value(&typed_substate_key, data) + .map(|typed_substate_value| (typed_substate_key, typed_substate_value)) + }) { + let TypedMetadataModuleSubstateKey::MetadataEntryKey(key) = key; + let value = match value { + TypedMetadataModuleSubstateValue::MetadataEntry(DynSubstate { + value, + .. + }) => value, + }; + map.entry(global_address) + .or_default() + .insert(key, value.unwrap()); + } + } else { + continue; + } + } + } + } + + Some(map) +} + +pub fn data_of_newly_minted_non_fungibles( + receipt: &TransactionReceipt, +) -> Option>> { + if !receipt.is_commit_success() { + return None; + } + + let mut map = HashMap::>::new(); + let commit_success = receipt.expect_commit_success(); + + for ((node_id, partition_number), database_update_map) in + commit_success.state_updates.system_updates.iter() + { + // Only care about non-fungible resource manager nodes, ignore everything else + if !node_id.entity_type().map_or(false, |entity_type| { + entity_type.is_global_non_fungible_resource_manager() + }) { + continue; + } + + for (substate_key, database_update) in database_update_map { + if let DatabaseUpdate::Set(data) = database_update { + if let Ok(( + TypedSubstateKey::MainModule( + TypedMainModuleSubstateKey::NonFungibleResourceData(non_fungible_local_id), + ), + TypedSubstateValue::MainModule( + TypedMainModuleSubstateValue::NonFungibleResourceData(DynSubstate { + value: non_fungible_data, + .. + }), + ), + )) = to_typed_substate_key( + node_id.entity_type().unwrap(), + *partition_number, + substate_key, + ) + .and_then(|typed_substate_key| { + to_typed_substate_value(&typed_substate_key, data) + .map(|typed_substate_value| (typed_substate_key, typed_substate_value)) + }) { + let resource_address = ResourceAddress::new_or_panic(node_id.0); + let non_fungible_local_id = non_fungible_local_id; + let non_fungible_data = scrypto_decode::( + &scrypto_encode(&non_fungible_data.unwrap()).unwrap(), + ) + .unwrap(); + + map.entry(resource_address) + .or_default() + .insert(non_fungible_local_id, non_fungible_data); + } + } else { + continue; + } + } + } + + Some(map) +} diff --git a/radix-engine-toolkit-core/tests/account_interactions.rs b/radix-engine-toolkit-core/tests/account_interactions.rs new file mode 100644 index 00000000..c45dc5da --- /dev/null +++ b/radix-engine-toolkit-core/tests/account_interactions.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 radix_engine_toolkit_core::instruction_visitor::core::traverser::traverse; +use radix_engine_toolkit_core::instruction_visitor::visitors::account_interactions_visitor::AccountInteractionsVisitor; +use radix_engine_toolkit_core::instruction_visitor::visitors::identity_interactions_visitor::IdentityInteractionsVisitor; +use scrypto::{api::node_modules::metadata::MetadataValue, prelude::*}; +use transaction::prelude::*; + +#[test] +fn account_withdraw_fungibles_interactions_count_as_withdraws_and_auth_requiring_interactions() { + // Arrange + let account = account(); + let manifest = ManifestBuilder::new() + .withdraw_from_account(account, RADIX_TOKEN, dec!("1")) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 1); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); + assert!(accounts_withdrawn_from.contains(&account)); +} + +#[test] +fn account_withdraw_non_fungibles_interactions_count_as_withdraws_and_auth_requiring_interactions() +{ + // Arrange + let account = account(); + let ids = non_fungible_ids(); + let manifest = ManifestBuilder::new() + .withdraw_non_fungibles_from_account(account, RADIX_TOKEN, &ids) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 1); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); + assert!(accounts_withdrawn_from.contains(&account)); +} + +#[test] +fn account_lock_fee_and_withdraw_fungibles_interactions_count_as_withdraws_and_auth_requiring_interactions( +) { + // Arrange + let account = account(); + let manifest = ManifestBuilder::new() + .lock_fee_and_withdraw(account, dec!("1"), RADIX_TOKEN, dec!("1")) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 1); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); + assert!(accounts_withdrawn_from.contains(&account)); +} + +#[test] +fn account_lock_fee_and_withdraw_non_fungibles_interactions_count_as_withdraws_and_auth_requiring_interactions( +) { + // Arrange + let account = account(); + let ids = non_fungible_ids(); + let manifest = ManifestBuilder::new() + .lock_fee_and_withdraw_non_fungibles(account, dec!("1"), RADIX_TOKEN, &ids) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 1); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); + assert!(accounts_withdrawn_from.contains(&account)); +} + +#[test] +fn account_lock_fee_interactions_count_as_auth_requiring_interactions() { + // Arrange + let account = account(); + let manifest = ManifestBuilder::new().lock_fee(account, dec!("1")).build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 0); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); +} + +#[test] +fn account_lock_contingent_fee_interactions_count_as_auth_requiring_interactions() { + // Arrange + let account = account(); + let manifest = ManifestBuilder::new() + .lock_contingent_fee(account, dec!("1")) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 0); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); +} + +#[test] +fn account_create_proof_interactions_count_as_auth_requiring_interactions() { + // Arrange + let account = account(); + let manifest = ManifestBuilder::new() + .create_proof_from_account_of_amount(account, RADIX_TOKEN, dec!("10")) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 0); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); +} + +#[test] +fn account_create_proof_by_amount_interactions_count_as_auth_requiring_interactions() { + // Arrange + let account = account(); + let manifest = ManifestBuilder::new() + .create_proof_from_account_of_amount(account, RADIX_TOKEN, dec!("1")) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 0); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); +} + +#[test] +fn account_create_proof_by_ids_interactions_count_as_auth_requiring_interactions() { + // Arrange + let account = account(); + let ids = non_fungible_ids(); + let manifest = ManifestBuilder::new() + .create_proof_from_account_of_non_fungibles(account, RADIX_TOKEN, &ids) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 0); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); +} + +#[test] +fn account_deposit_interactions_count_as_deposit_interactions() { + // Arrange + let account = account(); + let manifest = ManifestBuilder::new() + .take_all_from_worktop(RADIX_TOKEN, "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method(account, "deposit", manifest_args!(bucket)) + }) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 0); + assert_eq!(accounts_deposited_into.len(), 1); + + assert!(accounts_deposited_into.contains(&account)); +} + +#[test] +fn account_deposit_batch_interactions_count_as_deposit_interactions() { + // Arrange + let account = account(); + let manifest = ManifestBuilder::new() + .call_method( + account, + "deposit_batch", + manifest_args!(ManifestExpression::EntireWorktop), + ) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 0); + assert_eq!(accounts_deposited_into.len(), 1); + + assert!(accounts_deposited_into.contains(&account)); +} + +#[test] +fn account_set_metadata_interactions_count_as_auth_requiring_interactions() { + // Arrange + let account = account(); + let manifest = ManifestBuilder::new() + .set_metadata(account, "x", MetadataValue::Bool(true)) + .build(); + + // Act + let (accounts_requiring_auth, accounts_withdrawn_from, accounts_deposited_into) = + account_interactions(&manifest.instructions); + + // Assert + assert_eq!(accounts_requiring_auth.len(), 1); + assert_eq!(accounts_withdrawn_from.len(), 0); + assert_eq!(accounts_deposited_into.len(), 0); + + assert!(accounts_requiring_auth.contains(&account)); +} + +#[test] +fn identity_set_component_royalty_interactions_count_as_auth_requiring_interactions() { + // Arrange + let identity = identity(); + let manifest = ManifestBuilder::new() + .set_component_royalty(identity, "method", RoyaltyAmount::Free) + .build(); + + // Act + let identities_requiring_auth = identity_interactions(&manifest.instructions); + + // Assert + assert_eq!(identities_requiring_auth.len(), 1); + assert!(identities_requiring_auth.contains(&identity)); +} + +#[test] +fn identity_set_metadata_interactions_count_as_auth_requiring_interactions() { + // Arrange + let identity = identity(); + let manifest = ManifestBuilder::new() + .set_metadata(identity, "x", MetadataValue::Bool(true)) + .build(); + + // Act + let identities_requiring_auth = identity_interactions(&manifest.instructions); + + // Assert + assert_eq!(identities_requiring_auth.len(), 1); + assert!(identities_requiring_auth.contains(&identity)); +} + +#[test] +fn identity_claim_component_royalty_counts_as_auth_requiring_interactions() { + // Arrange + let identity = identity(); + let manifest = ManifestBuilder::new() + .claim_component_royalties(identity) + .build(); + + // Act + let identities_requiring_auth = identity_interactions(&manifest.instructions); + + // Assert + assert_eq!(identities_requiring_auth.len(), 1); + assert!(identities_requiring_auth.contains(&identity)); +} + +fn non_fungible_ids() -> BTreeSet { + BTreeSet::from([NonFungibleLocalId::integer(1)]) +} + +fn account() -> ComponentAddress { + let private_key = Secp256k1PrivateKey::from_u64(1).unwrap(); + let public_key = private_key.public_key(); + ComponentAddress::virtual_account_from_public_key(&public_key) +} + +fn identity() -> ComponentAddress { + let private_key = Secp256k1PrivateKey::from_u64(1).unwrap(); + let public_key = private_key.public_key(); + ComponentAddress::virtual_identity_from_public_key(&public_key) +} + +fn account_interactions( + instructions: &[InstructionV1], +) -> ( + HashSet, + HashSet, + HashSet, +) { + let mut account_interactions_visitor = AccountInteractionsVisitor::default(); + traverse(instructions, &mut [&mut account_interactions_visitor]).unwrap(); + account_interactions_visitor.output() +} + +fn identity_interactions(instructions: &[InstructionV1]) -> HashSet { + let mut identity_interactions_visitor = IdentityInteractionsVisitor::default(); + traverse(instructions, &mut [&mut identity_interactions_visitor]).unwrap(); + identity_interactions_visitor.output() +} diff --git a/radix-engine-toolkit-core/tests/account_proofs.rs b/radix-engine-toolkit-core/tests/account_proofs.rs new file mode 100644 index 00000000..661e0737 --- /dev/null +++ b/radix-engine-toolkit-core/tests/account_proofs.rs @@ -0,0 +1,95 @@ +// 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_core::instruction_visitor::core::traverser::traverse; +use radix_engine_toolkit_core::instruction_visitor::visitors::account_proofs_visitor::AccountProofsVisitor; +use scrypto::prelude::*; +use transaction::prelude::*; + +#[test] +fn account_proofs_visitor_picks_up_on_calls_to_create_proof() { + // Arrange + let manifest = ManifestBuilder::new() + .create_proof_from_account_of_amount(account(), RADIX_TOKEN, dec!("1")) + .create_proof_from_account_of_amount(account(), ACCOUNT_OWNER_BADGE, dec!("1")) + .build(); + + // Act + let resource_addresses = account_proofs(&manifest.instructions); + + // Assert + assert_eq!( + resource_addresses, + HashSet::from([RADIX_TOKEN, ACCOUNT_OWNER_BADGE]) + ); +} + +#[test] +fn account_proofs_visitor_picks_up_on_calls_to_create_proof_of_amount() { + // Arrange + let manifest = ManifestBuilder::new() + .create_proof_from_account_of_amount(account(), RADIX_TOKEN, dec!("10")) + .create_proof_from_account_of_amount(account(), ACCOUNT_OWNER_BADGE, dec!("10")) + .build(); + + // Act + let resource_addresses = account_proofs(&manifest.instructions); + + // Assert + assert_eq!( + resource_addresses, + HashSet::from([RADIX_TOKEN, ACCOUNT_OWNER_BADGE]) + ); +} + +#[test] +fn account_proofs_visitor_picks_up_on_calls_to_create_proof_of_non_fungibles() { + // Arrange + let manifest = ManifestBuilder::new() + .create_proof_from_account_of_non_fungibles( + account(), + RADIX_TOKEN, + &BTreeSet::from([NonFungibleLocalId::integer(1)]), + ) + .create_proof_from_account_of_non_fungibles( + account(), + ACCOUNT_OWNER_BADGE, + &BTreeSet::from([NonFungibleLocalId::integer(1)]), + ) + .build(); + + // Act + let resource_addresses = account_proofs(&manifest.instructions); + + // Assert + assert_eq!( + resource_addresses, + HashSet::from([RADIX_TOKEN, ACCOUNT_OWNER_BADGE]) + ); +} + +fn account() -> ComponentAddress { + let private_key = Secp256k1PrivateKey::from_u64(1).unwrap(); + let public_key = private_key.public_key(); + ComponentAddress::virtual_account_from_public_key(&public_key) +} + +fn account_proofs(instructions: &[InstructionV1]) -> HashSet { + let mut account_proofs_visitor = AccountProofsVisitor::default(); + traverse(instructions, &mut [&mut account_proofs_visitor]).unwrap(); + account_proofs_visitor.output() +} diff --git a/radix-engine-toolkit-core/tests/derive.rs b/radix-engine-toolkit-core/tests/derive.rs new file mode 100644 index 00000000..1fad164c --- /dev/null +++ b/radix-engine-toolkit-core/tests/derive.rs @@ -0,0 +1,148 @@ +// 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::prelude::AddressBech32Decoder; +use radix_engine_toolkit_core::functions::derive::{self, OlympiaNetwork}; +use scrypto::prelude::*; +use transaction::prelude::Secp256k1PrivateKey; + +#[test] +fn virtual_account_address_can_be_derived_from_public_key() { + // Arrange + let public_key = public_key(); + + // Act + let virtual_account_address = derive::virtual_account_address_from_public_key(&public_key); + + // Assert + assert_eq!( + virtual_account_address, + ComponentAddress::try_from_hex( + "d1d28b92b6e84499b83b0797ef5235553eeb7edaa0cea243c1128c2fe737" + ) + .unwrap() + ) +} + +#[test] +fn virtual_identity_address_can_be_derived_from_public_key() { + // Arrange + let public_key = public_key(); + + // Act + let virtual_identity_address = derive::virtual_identity_address_from_public_key(&public_key); + + // Assert + assert_eq!( + virtual_identity_address, + ComponentAddress::try_from_hex( + "d2d28b92b6e84499b83b0797ef5235553eeb7edaa0cea243c1128c2fe737" + ) + .unwrap() + ) +} + +#[test] +fn virtual_account_address_can_be_derived_from_olympia_account_address() { + // Arrange + let olympia_address = "rdx1qspx7zxmnrh36q33av24srdfzg7m3cj65968erpjuh7ja3rm3kmn6hq4j9842"; + let public_key = "026f08db98ef1d0231eb15580da9123db8e25aa1747c8c32e5fd2ec47b8db73d5c" + .parse::() + .unwrap(); + + // Act + let virtual_account_address = + derive::virtual_account_address_from_olympia_account_address(olympia_address).unwrap(); + + // Assert + assert_eq!( + virtual_account_address, + derive::virtual_account_address_from_public_key(&public_key) + ) +} + +#[test] +fn public_key_can_be_derived_from_olympia_account_address() { + // Arrange + let olympia_address = "rdx1qspx7zxmnrh36q33av24srdfzg7m3cj65968erpjuh7ja3rm3kmn6hq4j9842"; + let expected_public_key = "026f08db98ef1d0231eb15580da9123db8e25aa1747c8c32e5fd2ec47b8db73d5c" + .parse::() + .unwrap(); + + // Act + let public_key = derive::public_key_from_olympia_account_address(olympia_address).unwrap(); + + // Assert + assert_eq!(public_key, expected_public_key) +} + +#[test] +fn resource_address_can_be_derived_from_olympia_resource_address() { + // Arrange + let olympia_address = "floop_rr1q0p0hzap6ckxqdk6khesyft62w34e0vdd06msn9snhfqknl370"; + let expected_babylon_resource_address = AddressBech32Decoder::validate_and_decode_ignore_hrp( + "resource_rdx1tkhseye4w0hmf2af5enwurkxu4x29zk73yckyzhndv8xdk8tp2tn8q", + ) + .map(|(_, _, data)| NodeId(data.try_into().unwrap())) + .map(|node_id| ResourceAddress::new_or_panic(node_id.0)) + .unwrap(); + + // Act + let resource_address = + derive::resource_address_from_olympia_resource_address(olympia_address).unwrap(); + + // Assert + assert_eq!(resource_address, expected_babylon_resource_address) +} + +#[test] +fn olympia_address_can_be_derived_from_public_key() { + // Arrange + let expected_olympia_address = + "rdx1qspx7zxmnrh36q33av24srdfzg7m3cj65968erpjuh7ja3rm3kmn6hq4j9842"; + let public_key = "026f08db98ef1d0231eb15580da9123db8e25aa1747c8c32e5fd2ec47b8db73d5c" + .parse::() + .unwrap(); + + // Act + let olympia_address = + derive::olympia_account_address_from_public_key(&public_key, OlympiaNetwork::Mainnet); + + // Assert + assert_eq!(olympia_address, expected_olympia_address) +} + +#[test] +fn node_address_can_be_derived_from_public_key() { + // Arrange + let expected_node_address = + "node_tdx_21_1qfk895krd3l8t8z7z7p9sxpjdszpal24f6y2sjtqe7mdkhdele5az658ak2"; + let public_key = "026c72d2c36c7e759c5e17825818326c041efd554e88a84960cfb6db5db9fe69d1" + .parse::() + .unwrap(); + + // Act + let node_address = derive::node_address_from_public_key(&public_key, 0x21); + + // Assert + assert_eq!(node_address, expected_node_address) +} + +fn public_key() -> PublicKey { + let private_key = Secp256k1PrivateKey::from_u64(1).unwrap(); + private_key.public_key().into() +} diff --git a/radix-engine-toolkit-core/tests/execution.rs b/radix-engine-toolkit-core/tests/execution.rs new file mode 100644 index 00000000..2cfade22 --- /dev/null +++ b/radix-engine-toolkit-core/tests/execution.rs @@ -0,0 +1,177 @@ +// 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::system::system_modules::execution_trace::ResourceSpecifier; +use radix_engine::transaction::TransactionReceipt; +use radix_engine_toolkit_core::functions::execution::{self, *}; +use radix_engine_toolkit_core::instruction_visitor::visitors::transaction_type::transfer_visitor::Resources; +use scrypto::blueprints::account::*; +use scrypto::prelude::*; +use scrypto_unit::*; +use transaction::prelude::*; + +#[test] +fn simple_transfer_is_picked_up_as_a_simple_account_transfer_transaction() { + // Arrange + let mut test_runner = TestRunner::builder().build(); + let (public_key1, _, account1) = test_runner.new_account(true); + let (public_key2, _, account2) = test_runner.new_account(true); + + let manifest = ManifestBuilder::new() + .lock_fee(account1, dec!("10")) + .withdraw_from_account(account1, RADIX_TOKEN, dec!("10")) + .take_from_worktop(RADIX_TOKEN, dec!("10"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method( + account2, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .build(); + let receipt = test_runner.preview_manifest( + manifest.clone(), + vec![public_key1.into(), public_key2.into()], + 0, + PreviewFlags::default(), + ); + receipt.expect_commit_success(); + + // Act + let transaction_type = transaction_type(&manifest.instructions, &receipt); + + // Assert + assert_eq!( + transaction_type, + TransactionType::SimpleTransfer(Box::new(SimpleTransferTransactionType { + from: account1, + to: account2, + transferred: ResourceSpecifier::Amount(RADIX_TOKEN, dec!("10")) + })) + ) +} + +#[test] +fn transfer_is_picked_up_as_an_account_transfer_transaction() { + // Arrange + let mut test_runner = TestRunner::builder().build(); + let (public_key1, _, account1) = test_runner.new_account(true); + let (public_key2, _, account2) = test_runner.new_account(true); + let (public_key3, _, account3) = test_runner.new_account(true); + + let manifest = ManifestBuilder::new() + .lock_fee(account1, dec!("10")) + .withdraw_from_account(account1, RADIX_TOKEN, dec!("20")) + .take_from_worktop(RADIX_TOKEN, dec!("10"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method( + account2, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .take_from_worktop(RADIX_TOKEN, dec!("10"), "bucket2") + .with_bucket("bucket2", |builder, bucket| { + builder.call_method( + account3, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .build(); + let receipt = test_runner.preview_manifest( + manifest.clone(), + vec![public_key1.into(), public_key2.into(), public_key3.into()], + 0, + PreviewFlags::default(), + ); + receipt.expect_commit_success(); + + // Act + let transaction_type = transaction_type(&manifest.instructions, &receipt); + + // Assert + assert_eq!( + transaction_type, + TransactionType::Transfer(Box::new(TransferTransactionType { + from: account1, + transfers: hashmap! { + account2 => hashmap! { + RADIX_TOKEN => Resources::Amount(dec!("10")), + }, + account3 => hashmap! { + RADIX_TOKEN => Resources::Amount(dec!("10")), + } + } + })) + ) +} + +#[test] +fn complex_transfer_is_picked_up_as_an_general_transaction() { + // Arrange + let mut test_runner = TestRunner::builder().build(); + let (public_key1, _, account1) = test_runner.new_account(true); + let (public_key2, _, account2) = test_runner.new_account(true); + let (public_key3, _, account3) = test_runner.new_account(true); + + let manifest = ManifestBuilder::new() + .lock_fee(account1, dec!("10")) + .withdraw_from_account(account1, RADIX_TOKEN, dec!("10")) + .withdraw_from_account(account2, RADIX_TOKEN, dec!("10")) + .take_from_worktop(RADIX_TOKEN, dec!("10"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method( + account2, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .take_from_worktop(RADIX_TOKEN, dec!("10"), "bucket1") + .with_bucket("bucket1", |builder, bucket| { + builder.call_method( + account3, + ACCOUNT_TRY_DEPOSIT_OR_ABORT_IDENT, + manifest_args!(bucket), + ) + }) + .build(); + let receipt = test_runner.preview_manifest( + manifest.clone(), + vec![public_key1.into(), public_key2.into(), public_key3.into()], + 0, + PreviewFlags::default(), + ); + receipt.expect_commit_success(); + + // Act + let transaction_type = transaction_type(&manifest.instructions, &receipt); + + // Assert + assert!(matches!( + transaction_type, + TransactionType::GeneralTransaction(..) + )) +} + +fn transaction_type( + manifest_instructions: &[InstructionV1], + receipt: &TransactionReceipt, +) -> TransactionType { + let analysis = execution::analyze(manifest_instructions, receipt).unwrap(); + analysis.transaction_type +} diff --git a/radix-engine-toolkit-core/tests/information.rs b/radix-engine-toolkit-core/tests/information.rs new file mode 100644 index 00000000..f149df66 --- /dev/null +++ b/radix-engine-toolkit-core/tests/information.rs @@ -0,0 +1,23 @@ +// 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_core::functions::information; + +#[test] +fn information_can_be_obtained() { + information::information(); +} diff --git a/radix-engine-toolkit-core/tests/intent.rs b/radix-engine-toolkit-core/tests/intent.rs new file mode 100644 index 00000000..c80a276a --- /dev/null +++ b/radix-engine-toolkit-core/tests/intent.rs @@ -0,0 +1,73 @@ +// 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 transaction::validation::ValidationConfig; +mod test_data; + +#[test] +fn intent_hash_can_be_obtained() { + // Arrange + let intent = test_data::intent(); + + // Act + let hash = radix_engine_toolkit_core::functions::intent::hash(&intent); + + // Assert + assert!(hash.is_ok()) +} + +#[test] +fn intent_can_be_compiled() { + // Arrange + let intent = test_data::intent(); + + // Act + let compiled = radix_engine_toolkit_core::functions::intent::compile(&intent); + + // Assert + assert!(compiled.is_ok()) +} + +#[test] +fn intent_can_be_compiled_and_later_decompiled() { + // Arrange + let intent = test_data::intent(); + let compiled = radix_engine_toolkit_core::functions::intent::compile(&intent).unwrap(); + + // Act + let decompiled = radix_engine_toolkit_core::functions::intent::decompile(compiled); + + // Assert + assert!(decompiled.is_ok()); + assert_eq!(decompiled, Ok(intent)) +} + +#[test] +fn intent_can_be_statically_validated() { + // Arrange + let intent = test_data::intent(); + let validation_config = ValidationConfig::default(0x01); + + // Act + let validation_result = radix_engine_toolkit_core::functions::intent::statically_validate( + &intent, + validation_config, + ); + + // Assert + assert!(validation_result.is_ok()) +} diff --git a/radix-engine-toolkit-core/tests/manifest.rs b/radix-engine-toolkit-core/tests/manifest.rs new file mode 100644 index 00000000..312accc9 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifest.rs @@ -0,0 +1,69 @@ +// 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_data; + +#[test] +fn manifest_hash_can_be_obtained() { + // Arrange + let manifest = test_data::manifest(); + + // Act + let hash = radix_engine_toolkit_core::functions::manifest::hash(&manifest); + + // Assert + assert!(hash.is_ok()) +} + +#[test] +fn manifest_can_be_compiled() { + // Arrange + let manifest = test_data::manifest(); + + // Act + let compiled = radix_engine_toolkit_core::functions::manifest::compile(&manifest); + + // Assert + assert!(compiled.is_ok()) +} + +#[test] +fn manifest_can_be_compiled_and_later_decompiled() { + // Arrange + let manifest = test_data::manifest(); + let compiled = radix_engine_toolkit_core::functions::manifest::compile(&manifest).unwrap(); + + // Act + let decompiled = radix_engine_toolkit_core::functions::manifest::decompile(compiled); + + // Assert + assert!(decompiled.is_ok()); + assert_eq!(decompiled, Ok(manifest)) +} + +#[test] +fn manifest_can_be_statically_validated() { + // Arrange + let manifest = test_data::manifest(); + + // Act + let validation_result = + radix_engine_toolkit_core::functions::manifest::statically_validate(&manifest); + + // Assert + assert!(validation_result.is_ok()) +} diff --git a/radix-engine-toolkit-core/tests/manifest_sbor.rs b/radix-engine-toolkit-core/tests/manifest_sbor.rs new file mode 100644 index 00000000..10de0701 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifest_sbor.rs @@ -0,0 +1,89 @@ +// 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::prelude::{ + manifest_encode, AddressBech32Encoder, ManifestValue, ScryptoCustomSchema, +}; +use radix_engine_common::{ManifestSbor, ScryptoSbor}; +use radix_engine_toolkit_core::functions::manifest_sbor::ManifestSborStringRepresentation; +use sbor::{generate_full_schema_from_single_type, representations::SerializationMode}; + +#[test] +fn manifest_value_can_be_encoded() { + // Arrange + let value = ManifestValue::Bool { value: false }; + + // Act + let result = radix_engine_toolkit_core::functions::manifest_sbor::encode(&value); + + // Assert + assert!(result.is_ok()) +} + +#[test] +fn manifest_value_can_be_encoded_and_decoded_later() { + // Arrange + let value = ManifestValue::Bool { value: false }; + let encoded = radix_engine_toolkit_core::functions::manifest_sbor::encode(&value).unwrap(); + + // Act + let decoded = radix_engine_toolkit_core::functions::manifest_sbor::decode(encoded); + + // Assert + assert!(decoded.is_ok()); + assert_eq!(decoded, Ok(value)); +} + +#[test] +fn manifest_value_can_be_represented_as_a_string() { + // Arrange + let value = MyStruct { value: true }; + let encoded_value = manifest_encode(&value).unwrap(); + + let (local_type_index, schema) = + generate_full_schema_from_single_type::(); + + let serialization_modes_params = [ + ManifestSborStringRepresentation::ManifestString, + ManifestSborStringRepresentation::JSON(SerializationMode::Model), + ManifestSborStringRepresentation::JSON(SerializationMode::Natural), + ManifestSborStringRepresentation::JSON(SerializationMode::Programmatic), + ]; + let schema_params = [None, Some((local_type_index, schema))]; + let bech32_encoder = AddressBech32Encoder::for_simulator(); + + for representation in serialization_modes_params { + for schema in schema_params.clone() { + // Act + let result = + radix_engine_toolkit_core::functions::manifest_sbor::decode_to_string_representation( + encoded_value.clone(), + representation, + &bech32_encoder, + schema, + ); + + // Assert + assert!(result.is_ok()) + } + } +} + +#[derive(ManifestSbor, ScryptoSbor)] +struct MyStruct { + value: bool, +} diff --git a/radix-engine-toolkit-core/tests/manifests/access_controller/new.rtm b/radix-engine-toolkit-core/tests/manifests/access_controller/new.rtm new file mode 100644 index 00000000..0c6e446f --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/access_controller/new.rtm @@ -0,0 +1,12 @@ +TAKE_ALL_FROM_WORKTOP + Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") + Bucket("some_xrd"); + +CREATE_ACCESS_CONTROLLER + Bucket("some_xrd") + Tuple( + Enum(), + Enum(), + Enum() + ) + None; \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/access_rule/access_rule.rtm b/radix-engine-toolkit-core/tests/manifests/access_rule/access_rule.rtm new file mode 100644 index 00000000..07401614 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/access_rule/access_rule.rtm @@ -0,0 +1,12 @@ +SET_OWNER_ROLE + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Enum<0u8>(); # The rule associated with the role + +LOCK_OWNER_ROLE + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez"); + +SET_ROLE + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Enum<0u8>() + "hello" # The name of the role to update the access rule for. + Enum<0u8>(); # The rule associated with the role \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/account/deposit_modes.rtm b/radix-engine-toolkit-core/tests/manifests/account/deposit_modes.rtm new file mode 100644 index 00000000..3526e355 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/account/deposit_modes.rtm @@ -0,0 +1,52 @@ +# This transaction manifest file shows how an account could be configured to use any of the four +# allowed deposit modes. This manifest shows it for all four; thus, you're likely only going to need +# a subset of this full manifest. + +# ================================================================================================== +# 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. +# ================================================================================================== +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# Example 1: Allow All deposits mode +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "change_account_default_deposit_rule" + Enum(); + +# Example 2: Deny All deposits mode +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "change_account_default_deposit_rule" + Enum(); + +# Example 3: Allow existing deposits mode +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "change_account_default_deposit_rule" + Enum(); + +# Example 4a: Adding a resource to the allow list +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "configure_resource_deposit_rule" + Address("resource_sim1thcgx0f3rwaeetl67cmsssv4p748kd3sjhtge9l4m6ns7cucs97tjv") + Enum(); + +# Example 4a: Adding a resource to the deny list +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "configure_resource_deposit_rule" + Address("resource_sim1thcgx0f3rwaeetl67cmsssv4p748kd3sjhtge9l4m6ns7cucs97tjv") + Enum(); + +# Example 4a: Removing a resource from the allow and deny lists +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "configure_resource_deposit_rule" + Address("resource_sim1thcgx0f3rwaeetl67cmsssv4p748kd3sjhtge9l4m6ns7cucs97tjv") + Enum(); diff --git a/radix-engine-toolkit/tests/test_vector/manifest/account/multi_account_resource_transfer.rtm b/radix-engine-toolkit-core/tests/manifests/account/multi_account_resource_transfer.rtm similarity index 61% rename from radix-engine-toolkit/tests/test_vector/manifest/account/multi_account_resource_transfer.rtm rename to radix-engine-toolkit-core/tests/manifests/account/multi_account_resource_transfer.rtm index fc83f578..9030ae93 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/account/multi_account_resource_transfer.rtm +++ b/radix-engine-toolkit-core/tests/manifests/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 - Address("${this_account_component_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "lock_fee" - Decimal("10"); + Decimal("500"); # Withdrawing 330 XRD from the account component CALL_METHOD - Address("${this_account_component_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "withdraw" - Address("${xrd_resource_address}") + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("330"); # Taking 150 XRD from the worktop and depositing them into Account A -TAKE_FROM_WORKTOP_BY_AMOUNT +TAKE_FROM_WORKTOP + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("150") - Address("${xrd_resource_address}") Bucket("account_a_bucket"); CALL_METHOD - Address("${account_a_component_address}") - "deposit" + Address("account_sim1c8mulhl5yrk6hh4jsyldps5sdrp08r5v9wusupvzxgqvhlp4c4nwjz") + "try_deposit_or_abort" Bucket("account_a_bucket"); # Taking 130 XRD from the worktop and depositing them into Account B -TAKE_FROM_WORKTOP_BY_AMOUNT +TAKE_FROM_WORKTOP + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("130") - Address("${xrd_resource_address}") Bucket("account_b_bucket"); CALL_METHOD - Address("${account_b_component_address}") - "deposit" + Address("account_sim1c8s2hass5g62ckwpv78y8ykdqljtetv4ve6etcz64gveykxznj36tr") + "try_deposit_or_abort" Bucket("account_b_bucket"); # Taking 50 XRD from the worktop and depositing them into Account C -TAKE_FROM_WORKTOP_BY_AMOUNT +TAKE_FROM_WORKTOP + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("50") - Address("${xrd_resource_address}") Bucket("account_c_bucket"); CALL_METHOD - Address("${account_c_component_address}") - "deposit" + Address("account_sim1c8ct6jdcwqrg3gzskyxuy0z933fe55fyjz6p56730r95ulzwl3ppva") + "try_deposit_or_abort" Bucket("account_c_bucket"); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/account/new.rtm b/radix-engine-toolkit-core/tests/manifests/account/new.rtm new file mode 100644 index 00000000..fc0283e3 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/account/new.rtm @@ -0,0 +1,9 @@ +# The below just gives some example syntax +# You shouldn't configure your account to have an "AllowAll" access! (apart from maybe for testing) +CREATE_ACCOUNT_ADVANCED + Enum( + Enum() + ) +; + +CREATE_ACCOUNT; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm b/radix-engine-toolkit-core/tests/manifests/account/resource_transfer.rtm similarity index 70% rename from radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm rename to radix-engine-toolkit-core/tests/manifests/account/resource_transfer.rtm index 971710ea..9d3229d3 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/account/resource_transfer.rtm +++ b/radix-engine-toolkit-core/tests/manifests/account/resource_transfer.rtm @@ -8,19 +8,19 @@ # that you are using is resim then you can safely ignore this warning. # ================================================================================================== CALL_METHOD - Address("${this_account_component_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "lock_fee" - Decimal("10"); + Decimal("500"); # Withdrawing 100 XRD from the account component CALL_METHOD - Address("${this_account_component_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "withdraw" - Address("${xrd_resource_address}") + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("100"); # Depositing all of the XRD withdrawn from the account into the other account CALL_METHOD - Address("${other_account_component_address}") - "deposit_batch" + Address("account_sim1cyzfj6p254jy6lhr237s7pcp8qqz6c8ahq9mn6nkdjxxxat5syrgz9") + "try_deposit_batch_or_abort" Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/call/call_function.rtm b/radix-engine-toolkit-core/tests/manifests/call/call_function.rtm new file mode 100644 index 00000000..58bcc9b6 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/call/call_function.rtm @@ -0,0 +1,5 @@ +CALL_FUNCTION + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + "BlueprintName" + "f" + "string"; \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/call/call_method.rtm b/radix-engine-toolkit-core/tests/manifests/call/call_method.rtm new file mode 100644 index 00000000..fe5a3dbe --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/call/call_method.rtm @@ -0,0 +1,22 @@ +CALL_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "complicated_method" + Decimal("1") + PreciseDecimal("2"); + +CALL_ROYALTY_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "set_royalty" + "my_method" + Enum<0u8>(); + +CALL_METADATA_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "get" + "HelloWorld"; + +CALL_ACCESS_RULES_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "get_role" + Enum<0u8>() + "hello"; diff --git a/radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm b/radix-engine-toolkit-core/tests/manifests/faucet/free_funds.rtm similarity index 81% rename from radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm rename to radix-engine-toolkit-core/tests/manifests/faucet/free_funds.rtm index 13591a78..3c49a4d2 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/faucet/free_funds.rtm +++ b/radix-engine-toolkit-core/tests/manifests/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 - Address("${faucet_component_address}") + Address("component_sim1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxhkrefh") "lock_fee" - Decimal("10"); + Decimal("500"); # Calling the "free" method on the faucet component which is the method responsible for dispensing # XRD from the faucet. CALL_METHOD - Address("${faucet_component_address}") + Address("component_sim1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxhkrefh") "free"; # Depositing all of the XRD dispensed from the faucet into our account component. CALL_METHOD - Address("${account_component_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "deposit_batch" Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/identity/new.rtm b/radix-engine-toolkit-core/tests/manifests/identity/new.rtm new file mode 100644 index 00000000..b9cfe503 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/identity/new.rtm @@ -0,0 +1,4 @@ +CREATE_IDENTITY_ADVANCED + Enum(); + +CREATE_IDENTITY; \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/metadata/metadata.rtm b/radix-engine-toolkit-core/tests/manifests/metadata/metadata.rtm new file mode 100644 index 00000000..bf6809a3 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/metadata/metadata.rtm @@ -0,0 +1,213 @@ +# Set String Metadata on Package +SET_METADATA + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + "field_name" + # "Metadata::String" is equivalent to 0u8 + Enum( + "Metadata string value, eg description" + ); + +# Set String Metadata on Account component +SET_METADATA + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "field_name" + # "Metadata::String" is equivalent to 0u8 + Enum( + "Metadata string value, eg description" + ); + +# Set String Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::String" is equivalent to 0u8 + Enum( + "Metadata string value, eg description" + ); + +# Set Bool Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Bool" is equivalent to 1u8 + Enum( + true + ); + +# Set u8 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::U8" is equivalent to 2u8 + Enum( + 123u8 + ); + +# Set u32 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::U32" is equivalent to 3u8 + Enum( + 123u32 + ); + +# Set u64 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::U64" is equivalent to 4u8 + Enum( + 123u64 + ); + +# Set i32 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::I32" is equivalent to 5u8 + Enum( + -123i32 + ); + +# Set i64 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::I64" is equivalent to 6u8 + Enum( + -123i64 + ); + +# Set Decimal Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Decimal" is equivalent to 7u8 + Enum( # Single item + Decimal("10.5") + ); + +# Set Address Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Address" is equivalent to 8u8 + Enum( + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + ); + +# Set Public Key Metadata on Resource +# NOTE: Also see "PublicKeyHash" further down +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::PublicKey" is equivalent to 9u8 + Enum( + Enum( # 0u8 = Secp256k1, 1u8 = Ed25519 + # Hex-encoded canonical-Radix encoding of the public key + Bytes("0000000000000000000000000000000000000000000000000000000000000000ff") + ) + ); + +# Set NonFungibleGlobalId Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::NonFungibleGlobalId" is equivalent to 10u8 + Enum( + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:") + ); + +# Set NonFungibleLocalId Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::NonFungibleLocalId" is equivalent to 11u8 + Enum( + NonFungibleLocalId("") + ); + +# Set Instant (or the value in seconds since unix epoch) Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Instant" is equivalent to 12u8 + Enum( + # Value in seconds since Unix Epoch + 10000i64 + ); + +# Set Url Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Url" is equivalent to 13u8 + Enum( # Single item + "https://radixdlt.com/index.html" + ); + +# Set Origin Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Origin" is equivalent to 14u8 + Enum( + "https://radixdlt.com" + ); + +# Set PublicKeyHash Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::PublicKeyHash" is equivalent to 15u8 + Enum( + Enum( # 0u8 = Secp256k1, 1u8 = Ed25519 + # The hex-encoded final 29 bytes of the Blake2b-256 hash of the public key bytes (in the canonical Radix encoding) + Bytes("0000000000000000000000000000000000000000000000000000000000") + ) + ); + +# Setting list-based metadata: +# ============================ +# If using enum discriminator aliases: Take "Metadata::X" and add Array to the end, eg "Metadata::XArray" +# If using u8 enum discriminators: Add 128 to the single values +# +# Then just make the content an Array. +# +# For example, for strings: +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::StringArray" is equivalent to 128u8 + Enum( + Array( + "some_string", + "another_string", + "yet_another_string" + ) + ); + +LOCK_METADATA + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + "field_name"; + +LOCK_METADATA + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "field_name"; + +LOCK_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name"; + +REMOVE_METADATA + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + "field_name"; + +REMOVE_METADATA + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "field_name"; + +REMOVE_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name"; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/package/code.blob b/radix-engine-toolkit-core/tests/manifests/package/code.wasm similarity index 100% rename from radix-engine-toolkit/tests/test_vector/manifest/package/code.blob rename to radix-engine-toolkit-core/tests/manifests/package/code.wasm diff --git a/radix-engine-toolkit-core/tests/manifests/package/publish.rtm b/radix-engine-toolkit-core/tests/manifests/package/publish.rtm new file mode 100644 index 00000000..672e746d --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/package/publish.rtm @@ -0,0 +1,23 @@ +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("5000"); + +# Publishing a new package and setting some of its royalty and access rules. +PUBLISH_PACKAGE_ADVANCED + Enum() # Owner AccessRule + Tuple( # Package Definition + Map() + ) + Blob("a710f0959d8e139b3c1ca74ac4fcb9a95ada2c82e7f563304c5487e0117095c0") # Package Code + Map() # Metadata + None; # Address Reservation diff --git a/radix-engine-toolkit-core/tests/manifests/resources/auth_zone.rtm b/radix-engine-toolkit-core/tests/manifests/resources/auth_zone.rtm new file mode 100644 index 00000000..bc7b86f6 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/resources/auth_zone.rtm @@ -0,0 +1,34 @@ +## NOTE: This manifest is not intended to make cohesive sense +## - it is more intended to demonstrate various authzone-related commands + +# Withdraw XRD from account +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "withdraw" Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("5.0"); + +# Create a proof from bucket, clone it and drop both +TAKE_ALL_FROM_WORKTOP Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Bucket("some_xrd"); +CREATE_PROOF_FROM_BUCKET_OF_AMOUNT Bucket("some_xrd") Decimal("1") Proof("proof1a"); +CREATE_PROOF_FROM_BUCKET_OF_NON_FUNGIBLES Bucket("some_xrd") Array(NonFungibleLocalId("#123#")) Proof("proof1b"); +CREATE_PROOF_FROM_BUCKET_OF_ALL Bucket("some_xrd") Proof("proof1c"); +CLONE_PROOF Proof("proof1c") Proof("proof1d"); +DROP_PROOF Proof("proof1d"); +DROP_PROOF Proof("proof1c"); +CLEAR_AUTH_ZONE; + +# Create a proof from account and drop it +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "create_proof_of_amount" Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") Decimal("5.0"); +POP_FROM_AUTH_ZONE Proof("proof3"); +DROP_PROOF Proof("proof3"); + +# Compose proofs +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "create_proof_of_amount" Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") Decimal("5.0"); +CREATE_PROOF_FROM_AUTH_ZONE_OF_AMOUNT Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") Decimal("1") Proof("proof4"); +CREATE_PROOF_FROM_AUTH_ZONE_OF_NON_FUNGIBLES Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") Array(NonFungibleLocalId("#123#")) Proof("proof5"); +CREATE_PROOF_FROM_AUTH_ZONE_OF_ALL Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") Proof("proof6"); +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_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "deposit_batch" Expression("ENTIRE_WORKTOP"); diff --git a/radix-engine-toolkit-core/tests/manifests/resources/creation/fungible/no_initial_supply.rtm b/radix-engine-toolkit-core/tests/manifests/resources/creation/fungible/no_initial_supply.rtm new file mode 100644 index 00000000..e0cc8369 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/resources/creation/fungible/no_initial_supply.rtm @@ -0,0 +1,51 @@ +# This transaction manifest creates a new fungible resource with no initial supply and with the +# default auth. + +# ================================================================================================== +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# 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 + # Owner role - This gets metadata permissions, and is the default for other permissions + # Can set as Enum(access_rule) or Enum(access_rule) + Enum() + true # Whether the engine should track supply (avoid for massively parallelizable tokens) + 18u8 # Divisibility (between 0u8 and 18u8) + Tuple( + Some( # Mint Roles (if None: defaults to DenyAll, DenyAll) + Tuple( + Some(Enum()), # Minter (if None: defaults to Owner) + Some(Enum()) # Minter Updater (if None: defaults to Owner) + ) + ), + None, # Burn Roles (if None: defaults to DenyAll, DenyAll) + None, # Freeze Roles (if None: defaults to DenyAll, DenyAll) + None, # Recall Roles (if None: defaults to DenyAll, DenyAll) + None, # Withdraw Roles (if None: defaults to AllowAll, DenyAll) + None # Deposit Roles (if None: defaults to AllowAll, DenyAll) + ) + Tuple( # Metadata initialization + Map( # Initial metadata values + "name" => Tuple( + Some(Enum("MyResource")), # Resource Name + true # Locked + ) + ), + Map( # Metadata roles + "metadata_setter" => Some(Enum()), # Metadata setter role + "metadata_setter_updater" => None, # Metadata setter updater role as None defaults to OWNER + "metadata_locker" => Some(Enum()), # Metadata locker role + "metadata_locker_updater" => None # Metadata locker updater role as None defaults to OWNER + ) + ) + None; # No Address Reservation \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/resources/creation/fungible/with_initial_supply.rtm b/radix-engine-toolkit-core/tests/manifests/resources/creation/fungible/with_initial_supply.rtm new file mode 100644 index 00000000..93df44e9 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/resources/creation/fungible/with_initial_supply.rtm @@ -0,0 +1,59 @@ +# This transaction manifest creates a new fungible resource with initial supply and with the default +# auth. + +# ================================================================================================== +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# 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_WITH_INITIAL_SUPPLY + # Owner role - This gets metadata permissions, and is the default for other permissions + # Can set as Enum(access_rule) or Enum(access_rule) + Enum() + true # Whether the engine should track supply (avoid for massively parallelizable tokens) + 18u8 # Divisibility (between 0u8 and 18u8) + Decimal("12") # Initial supply + Tuple( + Some( # Mint Roles (if None: defaults to DenyAll, DenyAll) + Tuple( + Some(Enum()), # Minter (if None: defaults to Owner) + Some(Enum()) # Minter Updater (if None: defaults to Owner) + ) + ), + None, # Burn Roles (if None: defaults to DenyAll, DenyAll) + None, # Freeze Roles (if None: defaults to DenyAll, DenyAll) + None, # Recall Roles (if None: defaults to DenyAll, DenyAll) + None, # Withdraw Roles (if None: defaults to AllowAll, DenyAll) + None # Deposit Roles (if None: defaults to AllowAll, DenyAll) + ) + Tuple( # Metadata initialization + Map( # Initial metadata values + "name" => Tuple( + Some(Enum("MyResource")), # Resource Name + true # Locked + ) + ), + Map( # Metadata roles + "metadata_setter" => Some(Enum()), # Metadata setter role + "metadata_setter_updater" => None, # Metadata setter updater role as None defaults to OWNER + "metadata_locker" => Some(Enum()), # Metadata locker role + "metadata_locker_updater" => None # Metadata locker updater role as None defaults to OWNER + ) + ) + None; # No Address Reservation + +# Depositing the entirety of the initial supply of the newly created resource into our account +# component. +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/resources/creation/non_fungible/no_initial_supply.rtm b/radix-engine-toolkit-core/tests/manifests/resources/creation/non_fungible/no_initial_supply.rtm new file mode 100644 index 00000000..c496d829 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/resources/creation/non_fungible/no_initial_supply.rtm @@ -0,0 +1,52 @@ +# This transaction manifest creates a new non-fungible resource with no initial supply and with the +# default auth. + +# ================================================================================================== +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# Creating a new resource +CREATE_NON_FUNGIBLE_RESOURCE + # Owner role - This gets metadata permissions, and is the default for other permissions + # Can set as Enum(access_rule) or Enum(access_rule) + Enum() + Enum() # The type of NonFungible Id + true # Whether the engine should track supply (avoid for massively parallelizable tokens) + Tuple(Tuple(Array(), Array(), Array()), Enum<0u8>(64u8), Array()) # Non Fungible Data Schema + Tuple( + Some( # Mint Roles (if None: defaults to DenyAll, DenyAll) + Tuple( + Some(Enum()), # Minter (if None: defaults to Owner) + Some(Enum()) # Minter Updater (if None: defaults to Owner) + ) + ), + None, # Burn Roles (if None: defaults to DenyAll, DenyAll) + None, # Freeze Roles (if None: defaults to DenyAll, DenyAll) + None, # Recall Roles (if None: defaults to DenyAll, DenyAll) + None, # Withdraw Roles (if None: defaults to AllowAll, DenyAll) + None, # Deposit Roles (if None: defaults to AllowAll, DenyAll) + None # Non Fungible Data Update Roles (if None: defaults to DenyAll, DenyAll) + ) + Tuple( # Metadata initialization + Map( # Initial metadata values + "name" => Tuple( + Some(Enum("MyResource")), # Resource Name + true # Locked + ) + ), + Map( # Metadata roles + "metadata_setter" => Some(Enum()), # Metadata setter role + "metadata_setter_updater" => None, # Metadata setter updater role as None defaults to OWNER + "metadata_locker" => Some(Enum()), # Metadata locker role + "metadata_locker_updater" => None # Metadata locker updater role as None defaults to OWNER + ) + ) + None; # No Address Reservation \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/resources/creation/non_fungible/with_initial_supply.rtm b/radix-engine-toolkit-core/tests/manifests/resources/creation/non_fungible/with_initial_supply.rtm new file mode 100644 index 00000000..d4e1ef67 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/resources/creation/non_fungible/with_initial_supply.rtm @@ -0,0 +1,62 @@ +# This transaction manifest creates a new non-fungible resource with initial supply and with the +# default auth. + +# ================================================================================================== +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# Creating a new resource +CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY + # Owner role - This gets metadata permissions, and is the default for other permissions + # Can set as Enum(access_rule) or Enum(access_rule) + Enum() + Enum() # The type of NonFungible Id + true # Whether the engine should track supply (avoid for massively parallelizable tokens) + Tuple(Tuple(Array(), Array(), Array()), Enum<0u8>(64u8), Array()) # Non Fungible Data Schema + Map( # Initial supply to mint + NonFungibleLocalId("#12#") => Tuple(Tuple("Hello World", Decimal("12"))) + ) + Tuple( + Some( # Mint Roles (if None: defaults to DenyAll, DenyAll) + Tuple( + Some(Enum()), # Minter (if None: defaults to Owner) + Some(Enum()) # Minter Updater (if None: defaults to Owner) + ) + ), + None, # Burn Roles (if None: defaults to DenyAll, DenyAll) + None, # Freeze Roles (if None: defaults to DenyAll, DenyAll) + None, # Recall Roles (if None: defaults to DenyAll, DenyAll) + None, # Withdraw Roles (if None: defaults to AllowAll, DenyAll) + None, # Deposit Roles (if None: defaults to AllowAll, DenyAll) + None # Non Fungible Data Update Roles (if None: defaults to DenyAll, DenyAll) + ) + Tuple( # Metadata initialization + Map( # Initial metadata values + "name" => Tuple( + Some(Enum("MyResource")), # Resource Name + true # Locked + ) + ), + Map( # Metadata roles + "metadata_setter" => Some(Enum()), # Metadata setter role + "metadata_setter_updater" => None, # Metadata setter updater role as None defaults to OWNER + "metadata_locker" => Some(Enum()), # Metadata locker role + "metadata_locker_updater" => None # Metadata locker updater role as None defaults to OWNER + ) + ) + None; # No Address Reservation + +# Depositing the entirety of the initial supply of the newly created resource into our account +# component. +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/resources/freeze.rtm b/radix-engine-toolkit-core/tests/manifests/resources/freeze.rtm new file mode 100644 index 00000000..ca06afff --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/resources/freeze.rtm @@ -0,0 +1,23 @@ +# Freeze Withdraws from a vault +FREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(1u32); + +# Freeze Deposits into a vault +FREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(2u32); + +# Freeze Burns in a vault +FREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(4u32); + +# Freeze Withdraws/Deposits/Burns of a vault +FREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(7u32); + +# Unfreeze Withdraws from a vault +UNFREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(1u32); + +# Unfreeze Deposits into a vault +UNFREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(2u32); + +# Unfreeze Burns in a vault +UNFREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(4u32); + +# Unfreeze Withdraws/Deposits/Burns of a vault +UNFREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(7u32); diff --git a/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm b/radix-engine-toolkit-core/tests/manifests/resources/mint/fungible/mint.rtm similarity index 76% rename from radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm rename to radix-engine-toolkit-core/tests/manifests/resources/mint/fungible/mint.rtm index 658c5c62..5ac8a048 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/fungible/mint.rtm +++ b/radix-engine-toolkit-core/tests/manifests/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 - Address("${account_component_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "lock_fee" - Decimal("10"); + Decimal("500"); # 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 - Address("${account_component_address}") - "create_proof_by_amount" - Address("${minter_badge_resource_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "create_proof_of_amount" + Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") Decimal("1"); # Minting some amount of tokens from the mintable fungible resource MINT_FUNGIBLE - Address("${mintable_resource_address}") - Decimal("${mint_amount}"); + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Decimal("12"); # Depositing the entirety of the newly minted tokens into out account CALL_METHOD - Address("${account_component_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "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-core/tests/manifests/resources/mint/non_fungible/mint.rtm similarity index 75% rename from radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm rename to radix-engine-toolkit-core/tests/manifests/resources/mint/non_fungible/mint.rtm index dfcaf1ba..7d1b09cd 100644 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/mint/non_fungible/mint.rtm +++ b/radix-engine-toolkit-core/tests/manifests/resources/mint/non_fungible/mint.rtm @@ -13,32 +13,29 @@ # 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 - Address("${account_component_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "lock_fee" - Decimal("10"); + Decimal("500"); # 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 - Address("${account_component_address}") - "create_proof_by_amount" - Address("${minter_badge_resource_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "create_proof_of_amount" + Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") 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 - Address("${mintable_resource_address}") - Tuple( - Map( - NonFungibleLocalId("${non_fungible_local_id}"), - Tuple(Tuple()) - ) + Address("resource_sim1nfhtg7ttszgjwysfglx8jcjtvv8q02fg9s2y6qpnvtw5jsy3wvlhj6") + Map( + NonFungibleLocalId("#12#") => Tuple(Tuple()) ); # Depositing the entirety of the newly minted tokens into out account CALL_METHOD - Address("${account_component_address}") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "deposit_batch" Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/resources/recall.rtm b/radix-engine-toolkit-core/tests/manifests/resources/recall.rtm new file mode 100644 index 00000000..ff1f1d3a --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/resources/recall.rtm @@ -0,0 +1 @@ +RECALL_FROM_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Decimal("1.2"); diff --git a/radix-engine-toolkit-core/tests/manifests/resources/recall_non_fungibles.rtm b/radix-engine-toolkit-core/tests/manifests/resources/recall_non_fungibles.rtm new file mode 100644 index 00000000..8b8b7e0b --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/resources/recall_non_fungibles.rtm @@ -0,0 +1 @@ +RECALL_NON_FUNGIBLES_FROM_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Array(NonFungibleLocalId("#123#"), NonFungibleLocalId("#456#")); diff --git a/radix-engine-toolkit-core/tests/manifests/resources/worktop.rtm b/radix-engine-toolkit-core/tests/manifests/resources/worktop.rtm new file mode 100644 index 00000000..cafdd9a9 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/resources/worktop.rtm @@ -0,0 +1,21 @@ +## NOTE: This manifest is not intended to make cohesive sense +## - it is more intended to demonstrate various worktop-related commands + +# Withdraw XRD from account +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "withdraw" Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("5.0"); + +# Buy GUM with XRD +TAKE_FROM_WORKTOP Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("2.0") Bucket("xrd"); +CALL_METHOD Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") "buy_gumball" Bucket("xrd"); +ASSERT_WORKTOP_CONTAINS_ANY Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez"); +ASSERT_WORKTOP_CONTAINS Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") Decimal("3.0"); + +# Create a proof from bucket, clone it and drop both +TAKE_ALL_FROM_WORKTOP Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Bucket("some_xrd"); + +# Return a bucket to worktop +RETURN_TO_WORKTOP Bucket("some_xrd"); +TAKE_NON_FUNGIBLES_FROM_WORKTOP Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") Array(NonFungibleLocalId("#1#")) Bucket("nfts"); + +# Move all resources in worktop to account +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "deposit_batch" Expression("ENTIRE_WORKTOP"); diff --git a/radix-engine-toolkit-core/tests/manifests/royalty/royalty.rtm b/radix-engine-toolkit-core/tests/manifests/royalty/royalty.rtm new file mode 100644 index 00000000..bd5624c6 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/royalty/royalty.rtm @@ -0,0 +1,14 @@ +SET_COMPONENT_ROYALTY + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "my_method" + Enum(); + +LOCK_COMPONENT_ROYALTY + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "my_method"; + +CLAIM_PACKAGE_ROYALTIES + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk"); + +CLAIM_COMPONENT_ROYALTIES + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q"); \ No newline at end of file diff --git a/radix-engine-toolkit-core/tests/manifests/validator/new.rtm b/radix-engine-toolkit-core/tests/manifests/validator/new.rtm new file mode 100644 index 00000000..3cdbdcbd --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/validator/new.rtm @@ -0,0 +1,18 @@ +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "withdraw" + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") + Decimal("1000"); + +TAKE_FROM_WORKTOP + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") + Decimal("1000") + Bucket("xrd_payment"); + +CREATE_VALIDATOR + # Secp256k1 Public Key Bytes + Bytes("02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5") + # Validator fee factor + Decimal("1") + # XRD payment + Bucket("xrd_payment"); diff --git a/radix-engine-toolkit-core/tests/manifests/values/values.rtm b/radix-engine-toolkit-core/tests/manifests/values/values.rtm new file mode 100644 index 00000000..08e5f377 --- /dev/null +++ b/radix-engine-toolkit-core/tests/manifests/values/values.rtm @@ -0,0 +1,73 @@ +TAKE_ALL_FROM_WORKTOP + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Bucket("temp1"); +CREATE_PROOF_FROM_AUTH_ZONE_OF_ALL + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Proof("temp2"); + +CALL_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "aliases" + + # enum + None + Enum<0u8>() + Some("hello") + Enum<1u8>( "hello") + Ok("test") + Enum<0u8>( "test") + Err("test123") + Enum<1u8>( "test123") + Enum() + Enum( "a") + Enum( "b") + Enum( "c") + + # bytes + Bytes("deadbeef") + Array(5u8, 10u8, 255u8) + + # non-fungible address + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:") + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:#123#") + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:#456#") + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:#1234567890#") + Tuple(Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha"), NonFungibleLocalId("#1#")) + + # array + Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) + Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) + Array(NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:"), Tuple(Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha"), NonFungibleLocalId("#1#"))) + Array(NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:"), Tuple(Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha"), NonFungibleLocalId("#1#"))) + Array(Some("hello")) + Array(Enum<1u8>(), Enum()) + Array(Map()) + + # map + Map(1u8 => 5u16) +; + +CALL_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "custom_types" + + # Address + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + Address("consensusmanager_sim1scxxxxxxxxxxcnsmgrxxxxxxxxx000999665565xxxxxxxxxxc06cl") + Address("validator_sim1svzs2pg9q5zs2pg9q5zs2pg9q5zs2pg9q5zs2pg9q5zs2pg9wr6hj0") + Address("accesscontroller_sim1cvvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvexaj7at") + + Bucket("temp1") + Proof("temp2") + Expression("ENTIRE_WORKTOP") + Blob("a710f0959d8e139b3c1ca74ac4fcb9a95ada2c82e7f563304c5487e0117095c0") + + Decimal("1.2") + PreciseDecimal("1.2") + NonFungibleLocalId("") + NonFungibleLocalId("#12#") + NonFungibleLocalId("[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") + NonFungibleLocalId("{1111111111111111-1111111111111111-1111111111111111-1111111111111111}") +; diff --git a/radix-engine-toolkit-core/tests/notarized_transaction.rs b/radix-engine-toolkit-core/tests/notarized_transaction.rs new file mode 100644 index 00000000..62875fab --- /dev/null +++ b/radix-engine-toolkit-core/tests/notarized_transaction.rs @@ -0,0 +1,77 @@ +// 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 transaction::validation::ValidationConfig; +mod test_data; + +#[test] +fn notarized_transaction_hash_can_be_obtained() { + // Arrange + let transaction = test_data::notarized_transaction(); + + // Act + let hash = radix_engine_toolkit_core::functions::notarized_transaction::hash(&transaction); + + // Assert + assert!(hash.is_ok()) +} + +#[test] +fn notarized_transaction_can_be_compiled() { + // Arrange + let transaction = test_data::notarized_transaction(); + + // Act + let compiled = + radix_engine_toolkit_core::functions::notarized_transaction::compile(&transaction); + + // Assert + assert!(compiled.is_ok()) +} + +#[test] +fn notarized_transaction_can_be_compiled_and_later_decompiled() { + // Arrange + let transaction = test_data::notarized_transaction(); + let compiled = + radix_engine_toolkit_core::functions::notarized_transaction::compile(&transaction).unwrap(); + + // Act + let decompiled = + radix_engine_toolkit_core::functions::notarized_transaction::decompile(compiled); + + // Assert + assert!(decompiled.is_ok()); + assert_eq!(decompiled, Ok(transaction)) +} + +#[test] +fn notarized_transaction_can_be_statically_validated() { + // Arrange + let transaction = test_data::notarized_transaction(); + let validation_config = ValidationConfig::default(0x01); + + // Act + let validation_result = + radix_engine_toolkit_core::functions::notarized_transaction::statically_validate( + &transaction, + validation_config, + ); + + // Assert + assert!(validation_result.is_ok()) +} diff --git a/radix-engine-toolkit-core/tests/schema_visitor.rs b/radix-engine-toolkit-core/tests/schema_visitor.rs new file mode 100644 index 00000000..f8cfb937 --- /dev/null +++ b/radix-engine-toolkit-core/tests/schema_visitor.rs @@ -0,0 +1,117 @@ +// 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::prelude::ScryptoCustomSchema; +use radix_engine_common::ScryptoSbor; +use radix_engine_toolkit_core::schema_visitor::core::traverser::traverse; +use radix_engine_toolkit_core::schema_visitor::visitors::bucket_in_path_visitor::BucketInPathVisitor; +use radix_engine_toolkit_core::schema_visitor::visitors::proof_in_path_visitor::ProofInPathVisitor; +use sbor::generate_full_schema_from_single_type; +use scrypto::blueprints::account::*; +use scrypto::prelude::*; +use std::collections::BTreeMap; + +#[derive(ScryptoSbor)] +struct MyStruct { + item: (u32, BTreeMap, BTreeMap), +} + +#[test] +fn bucket_in_path_visitor_can_detect_a_bucket_in_the_schema() { + // Arrange + let (local_type_index, schema) = + generate_full_schema_from_single_type::(); + + // Act + let mut visitor = BucketInPathVisitor::default(); + traverse(&schema, local_type_index, &mut [&mut visitor]).unwrap(); + + // Assert + assert!(visitor.path_contains_bucket()) +} + +#[test] +fn bucket_in_path_visitor_can_detect_a_bucket_thats_nested() { + // Arrange + let (local_type_index, schema) = + generate_full_schema_from_single_type::(); + + // Act + let mut visitor = BucketInPathVisitor::default(); + traverse(&schema, local_type_index, &mut [&mut visitor]).unwrap(); + + // Assert + assert!(visitor.path_contains_bucket()) +} + +#[test] +fn bucket_in_path_visitor_does_not_detect_non_existent_buckets() { + // Arrange + let (local_type_index, schema) = + generate_full_schema_from_single_type::(); + + // Act + let mut visitor = BucketInPathVisitor::default(); + traverse(&schema, local_type_index, &mut [&mut visitor]).unwrap(); + + // Assert + assert!(!visitor.path_contains_bucket()) +} + +#[test] +fn proof_in_path_visitor_can_detect_a_proof_in_the_schema() { + // Arrange + let (local_type_index, schema) = generate_full_schema_from_single_type::< + AccountCreateProofOfAmountOutput, + ScryptoCustomSchema, + >(); + + // Act + let mut visitor = ProofInPathVisitor::default(); + traverse(&schema, local_type_index, &mut [&mut visitor]).unwrap(); + + // Assert + assert!(visitor.path_contains_proof()) +} + +#[test] +fn proof_in_path_visitor_can_detect_a_proof_thats_nested() { + // Arrange + let (local_type_index, schema) = + generate_full_schema_from_single_type::(); + + // Act + let mut visitor = ProofInPathVisitor::default(); + traverse(&schema, local_type_index, &mut [&mut visitor]).unwrap(); + + // Assert + assert!(visitor.path_contains_proof()) +} + +#[test] +fn proof_in_path_visitor_does_not_detect_non_existent_proofs() { + // Arrange + let (local_type_index, schema) = + generate_full_schema_from_single_type::(); + + // Act + let mut visitor = ProofInPathVisitor::default(); + traverse(&schema, local_type_index, &mut [&mut visitor]).unwrap(); + + // Assert + assert!(!visitor.path_contains_proof()) +} diff --git a/radix-engine-toolkit-core/tests/scrypto_sbor.rs b/radix-engine-toolkit-core/tests/scrypto_sbor.rs new file mode 100644 index 00000000..151de338 --- /dev/null +++ b/radix-engine-toolkit-core/tests/scrypto_sbor.rs @@ -0,0 +1,87 @@ +// 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::prelude::{ + scrypto_encode, AddressBech32Encoder, ScryptoCustomSchema, ScryptoValue, +}; +use radix_engine_common::ScryptoSbor; +use sbor::{generate_full_schema_from_single_type, representations::SerializationMode}; + +#[test] +fn scrypto_value_can_be_encoded() { + // Arrange + let value = ScryptoValue::Bool { value: false }; + + // Act + let result = radix_engine_toolkit_core::functions::scrypto_sbor::encode(&value); + + // Assert + assert!(result.is_ok()) +} + +#[test] +fn scrypto_value_can_be_encoded_and_decoded_later() { + // Arrange + let value = ScryptoValue::Bool { value: false }; + let encoded = radix_engine_toolkit_core::functions::scrypto_sbor::encode(&value).unwrap(); + + // Act + let decoded = radix_engine_toolkit_core::functions::scrypto_sbor::decode(encoded); + + // Assert + assert!(decoded.is_ok()); + assert_eq!(decoded, Ok(value)); +} + +#[test] +fn scrypto_value_can_be_represented_as_a_string() { + // Arrange + let value = MyStruct { value: true }; + let encoded_value = scrypto_encode(&value).unwrap(); + + let (local_type_index, schema) = + generate_full_schema_from_single_type::(); + + let serialization_modes_params = [ + SerializationMode::Model, + SerializationMode::Natural, + SerializationMode::Programmatic, + ]; + let schema_params = [None, Some((local_type_index, schema))]; + let bech32_encoder = AddressBech32Encoder::for_simulator(); + + for representation in serialization_modes_params { + for schema in schema_params.clone() { + // Act + let result = + radix_engine_toolkit_core::functions::scrypto_sbor::decode_to_string_representation( + encoded_value.clone(), + representation, + &bech32_encoder, + schema, + ); + + // Assert + assert!(result.is_ok()) + } + } +} + +#[derive(ScryptoSbor)] +struct MyStruct { + value: bool, +} diff --git a/radix-engine-toolkit-core/tests/signed_intent.rs b/radix-engine-toolkit-core/tests/signed_intent.rs new file mode 100644 index 00000000..942aa7b1 --- /dev/null +++ b/radix-engine-toolkit-core/tests/signed_intent.rs @@ -0,0 +1,75 @@ +// 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 transaction::validation::ValidationConfig; +mod test_data; + +#[test] +fn signed_intent_hash_can_be_obtained() { + // Arrange + let signed_intent = test_data::signed_intent(); + + // Act + let hash = radix_engine_toolkit_core::functions::signed_intent::hash(&signed_intent); + + // Assert + assert!(hash.is_ok()) +} + +#[test] +fn signed_intent_can_be_compiled() { + // Arrange + let signed_intent = test_data::signed_intent(); + + // Act + let compiled = radix_engine_toolkit_core::functions::signed_intent::compile(&signed_intent); + + // Assert + assert!(compiled.is_ok()) +} + +#[test] +fn signed_intent_can_be_compiled_and_later_decompiled() { + // Arrange + let signed_intent = test_data::signed_intent(); + let compiled = + radix_engine_toolkit_core::functions::signed_intent::compile(&signed_intent).unwrap(); + + // Act + let decompiled = radix_engine_toolkit_core::functions::signed_intent::decompile(compiled); + + // Assert + assert!(decompiled.is_ok()); + assert_eq!(decompiled, Ok(signed_intent)) +} + +#[test] +fn signed_intent_can_be_statically_validated() { + // Arrange + let signed_intent = test_data::signed_intent(); + let validation_config = ValidationConfig::default(0x01); + + // Act + let validation_result = + radix_engine_toolkit_core::functions::signed_intent::statically_validate( + &signed_intent, + validation_config, + ); + + // Assert + assert!(validation_result.is_ok()) +} diff --git a/radix-engine-toolkit-core/tests/simple_transfer_visitor.rs b/radix-engine-toolkit-core/tests/simple_transfer_visitor.rs new file mode 100644 index 00000000..7742d22c --- /dev/null +++ b/radix-engine-toolkit-core/tests/simple_transfer_visitor.rs @@ -0,0 +1,130 @@ +// 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::system::system_modules::execution_trace::ResourceSpecifier; +use radix_engine_toolkit_core::{ + instruction_visitor::visitors::transaction_type::simple_transfer_visitor::SimpleTransactionTypeVisitor, + traverse_instructions, +}; +use scrypto::prelude::*; +use transaction::prelude::ManifestBuilder; + +mod test_data; + +#[test] +pub fn simple_transfer_visitor_can_pick_up_fungible_transfer() { + // Arrange + let account1 = test_data::account1(); + let account2 = test_data::account2(); + + let manifest = ManifestBuilder::new() + .withdraw_from_account(account1, RADIX_TOKEN, dec!("10")) + .take_from_worktop(RADIX_TOKEN, dec!("10"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method(account2, "deposit", manifest_args!(bucket)) + }) + .build(); + + // Act + let mut simple_transfer_visitor = SimpleTransactionTypeVisitor::default(); + let (from_account, to_account, resource_specifier) = + traverse_instructions!(&manifest.instructions, simple_transfer_visitor) + .unwrap() + .unwrap(); + + // Assert + assert_eq!(from_account, account1); + assert_eq!(to_account, account2); + assert_eq!( + resource_specifier, + ResourceSpecifier::Amount(RADIX_TOKEN, dec!("10")) + ); +} + +#[test] +pub fn simple_transfer_visitor_can_pick_up_non_fungible_transfer() { + // Arrange + let account1 = test_data::account1(); + let account2 = test_data::account2(); + + let manifest = ManifestBuilder::new() + .withdraw_non_fungibles_from_account( + account1, + RADIX_TOKEN, + &BTreeSet::from([ + NonFungibleLocalId::integer(1), + NonFungibleLocalId::integer(2), + ]), + ) + .take_from_worktop(RADIX_TOKEN, dec!("2"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method(account2, "deposit", manifest_args!(bucket)) + }) + .build(); + + // Act + let mut simple_transfer_visitor = SimpleTransactionTypeVisitor::default(); + let (from_account, to_account, resource_specifier) = + traverse_instructions!(&manifest.instructions, simple_transfer_visitor) + .unwrap() + .unwrap(); + + // Assert + assert_eq!(from_account, account1); + assert_eq!(to_account, account2); + assert_eq!( + resource_specifier, + ResourceSpecifier::Ids( + RADIX_TOKEN, + BTreeSet::from([ + NonFungibleLocalId::integer(1), + NonFungibleLocalId::integer(2), + ]) + ) + ); +} + +#[test] +pub fn simple_transfer_visitor_invalidated_transfer_with_an_additional_withdraw() { + // Arrange + let account1 = test_data::account1(); + let account2 = test_data::account2(); + + let manifest = ManifestBuilder::new() + .withdraw_from_account(account1, RADIX_TOKEN, dec!("10")) + .withdraw_non_fungibles_from_account( + account1, + RADIX_TOKEN, + &BTreeSet::from([ + NonFungibleLocalId::integer(1), + NonFungibleLocalId::integer(2), + ]), + ) + .take_from_worktop(RADIX_TOKEN, dec!("2"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method(account2, "deposit", manifest_args!(bucket)) + }) + .build(); + + // Act + let mut simple_transfer_visitor = SimpleTransactionTypeVisitor::default(); + let transfer_data = + traverse_instructions!(&manifest.instructions, simple_transfer_visitor).unwrap(); + + // Assert + assert!(transfer_data.is_none()) +} diff --git a/radix-engine-toolkit-core/tests/test_data.rs b/radix-engine-toolkit-core/tests/test_data.rs new file mode 100644 index 00000000..f6cf05ca --- /dev/null +++ b/radix-engine-toolkit-core/tests/test_data.rs @@ -0,0 +1,98 @@ +// 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(unused)] + +use radix_engine_toolkit_core::functions::*; +use scrypto::prelude::*; +use transaction::builder::*; +use transaction::model::*; +use transaction::prelude::*; +use transaction::validation::*; + +pub fn notarized_transaction() -> NotarizedTransactionV1 { + let account1 = derive::virtual_account_address_from_public_key(&private_key1().public_key()); + let account2 = derive::virtual_account_address_from_public_key(&private_key2().public_key()); + + TransactionBuilder::new() + .manifest( + ManifestBuilder::new() + .withdraw_from_account(account1, RADIX_TOKEN, dec!("10")) + .try_deposit_batch_or_abort(account2) + .build(), + ) + .header(TransactionHeaderV1 { + network_id: 0x01, + start_epoch_inclusive: Epoch::of(100), + end_epoch_exclusive: Epoch::of(200), + nonce: 100, + notary_public_key: private_key1().public_key().into(), + notary_is_signatory: true, + tip_percentage: 0, + }) + .sign(&private_key2()) + .sign(&private_key3()) + .sign(&private_key4()) + .notarize(&private_key1()) + .build() +} + +pub fn signed_intent() -> SignedIntentV1 { + notarized_transaction().signed_intent +} + +pub fn intent() -> IntentV1 { + signed_intent().intent +} + +pub fn manifest() -> TransactionManifestV1 { + radix_engine_toolkit_core::utils::manifest_from_intent(&intent()) +} + +pub fn private_key1() -> Secp256k1PrivateKey { + Secp256k1PrivateKey::from_u64(1).unwrap() +} + +pub fn private_key2() -> Ed25519PrivateKey { + Ed25519PrivateKey::from_u64(1).unwrap() +} + +pub fn private_key3() -> Secp256k1PrivateKey { + Secp256k1PrivateKey::from_u64(2).unwrap() +} + +pub fn private_key4() -> Ed25519PrivateKey { + Ed25519PrivateKey::from_u64(2).unwrap() +} + +pub fn account1() -> ComponentAddress { + let private_key = Secp256k1PrivateKey::from_u64(1).unwrap(); + let public_key = private_key.public_key(); + ComponentAddress::virtual_account_from_public_key(&public_key) +} + +pub fn account2() -> ComponentAddress { + let private_key = Secp256k1PrivateKey::from_u64(2).unwrap(); + let public_key = private_key.public_key(); + ComponentAddress::virtual_account_from_public_key(&public_key) +} + +pub fn account3() -> ComponentAddress { + let private_key = Secp256k1PrivateKey::from_u64(3).unwrap(); + let public_key = private_key.public_key(); + ComponentAddress::virtual_account_from_public_key(&public_key) +} diff --git a/radix-engine-toolkit-core/tests/transfer_visitor.rs b/radix-engine-toolkit-core/tests/transfer_visitor.rs new file mode 100644 index 00000000..68608fb7 --- /dev/null +++ b/radix-engine-toolkit-core/tests/transfer_visitor.rs @@ -0,0 +1,166 @@ +// 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_core::instruction_visitor::visitors::transaction_type::transfer_visitor::{ + Resources, TransferTransactionTypeVisitor, +}; +use radix_engine_toolkit_core::traverse_instructions; +use scrypto::prelude::*; +use transaction::prelude::ManifestBuilder; + +mod test_data; + +#[test] +pub fn transfer_visitor_can_pick_up_fungible_transfer() { + // Arrange + let account1 = test_data::account1(); + let account2 = test_data::account2(); + + let manifest = ManifestBuilder::new() + .withdraw_from_account(account1, RADIX_TOKEN, dec!("10")) + .take_from_worktop(RADIX_TOKEN, dec!("10"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method(account2, "deposit", manifest_args!(bucket)) + }) + .build(); + + // Act + let mut transfer_visitor = TransferTransactionTypeVisitor::default(); + let (source_account, deposits) = + traverse_instructions!(&manifest.instructions, transfer_visitor) + .unwrap() + .unwrap(); + + // Assert + assert_eq!(source_account, account1); + assert_eq!( + deposits, + hashmap!( + account2 => hashmap! { + RADIX_TOKEN => Resources::Amount(dec!("10")) + } + ) + ); +} + +#[test] +pub fn transfer_visitor_can_pick_up_fungible_transfer_from_a_single_source_to_multiple_recipients() +{ + // Arrange + let account1 = test_data::account1(); + let account2 = test_data::account2(); + let account3 = test_data::account3(); + + let manifest = ManifestBuilder::new() + .withdraw_from_account(account1, RADIX_TOKEN, dec!("20")) + .take_from_worktop(RADIX_TOKEN, dec!("15"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method(account2, "deposit", manifest_args!(bucket)) + }) + .take_from_worktop(RADIX_TOKEN, dec!("5"), "bucket1") + .with_bucket("bucket1", |builder, bucket| { + builder.call_method(account3, "deposit", manifest_args!(bucket)) + }) + .build(); + + // Act + let mut transfer_visitor = TransferTransactionTypeVisitor::default(); + let (source_account, deposits) = + traverse_instructions!(&manifest.instructions, transfer_visitor) + .unwrap() + .unwrap(); + + // Assert + assert_eq!(source_account, account1); + assert_eq!( + deposits, + hashmap!( + account2 => hashmap! { + RADIX_TOKEN => Resources::Amount(dec!("15")) + }, + account3 => hashmap! { + RADIX_TOKEN => Resources::Amount(dec!("5")) + } + ) + ); +} + +#[test] +pub fn transfer_visitor_invalidated_transfer_from_multiple_accounts() { + // Arrange + let account1 = test_data::account1(); + let account2 = test_data::account2(); + + let manifest = ManifestBuilder::new() + .withdraw_from_account(account1, RADIX_TOKEN, dec!("10")) + .withdraw_from_account(account2, RADIX_TOKEN, dec!("10")) + .take_from_worktop(RADIX_TOKEN, dec!("20"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method(account2, "deposit", manifest_args!(bucket)) + }) + .build(); + + // Act + let mut transfer_visitor = TransferTransactionTypeVisitor::default(); + let result = traverse_instructions!(&manifest.instructions, transfer_visitor).unwrap(); + + // Assert + assert!(result.is_none()); +} + +#[test] +pub fn transfer_visitor_can_pick_up_non_fungible_transfer() { + // Arrange + let account1 = test_data::account1(); + let account2 = test_data::account2(); + + let manifest = ManifestBuilder::new() + .withdraw_non_fungibles_from_account( + account1, + RADIX_TOKEN, + &BTreeSet::from([ + NonFungibleLocalId::integer(1), + NonFungibleLocalId::integer(2), + ]), + ) + .take_from_worktop(RADIX_TOKEN, dec!("2"), "bucket") + .with_bucket("bucket", |builder, bucket| { + builder.call_method(account2, "deposit", manifest_args!(bucket)) + }) + .build(); + + // Act + let mut transfer_visitor = TransferTransactionTypeVisitor::default(); + let (source_account, deposits) = + traverse_instructions!(&manifest.instructions, transfer_visitor) + .unwrap() + .unwrap(); + + // Assert + assert_eq!(source_account, account1); + assert_eq!( + deposits, + hashmap!( + account2 => hashmap! { + RADIX_TOKEN => Resources::Ids(BTreeSet::from([ + NonFungibleLocalId::integer(1), + NonFungibleLocalId::integer(2), + ])) + } + ) + ); +} diff --git a/radix-engine-toolkit-core/tests/utils.rs b/radix-engine-toolkit-core/tests/utils.rs new file mode 100644 index 00000000..694b13ca --- /dev/null +++ b/radix-engine-toolkit-core/tests/utils.rs @@ -0,0 +1,148 @@ +// 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::types::*; +use radix_engine_interface::metadata_init; +use scrypto::api::node_modules::metadata::MetadataValue; +use scrypto::prelude::ModuleConfig; +use scrypto::*; +use scrypto_unit::*; +use transaction::prelude::*; + +#[test] +fn extraction_of_metadata_from_receipts_succeeds() { + // Arrange + let mut test_runner = TestRunner::builder().without_trace().build(); + + // Act + let manifest = ManifestBuilder::new() + .create_fungible_resource( + OwnerRole::None, + true, + 18, + FungibleResourceRoles::default(), + metadata! { + init { + "name" => true, locked; + } + }, + None, + ) + .build(); + let receipt = test_runner.execute_manifest_ignoring_fee(manifest, vec![]); + let metadata = radix_engine_toolkit_core::utils::metadata_of_newly_created_entities(&receipt); + + // Assert + let metadata = metadata.expect("Cant be none"); + let global_address = GlobalAddress::from( + *receipt + .expect_commit_success() + .new_resource_addresses() + .get(0) + .unwrap(), + ); + assert_eq!( + metadata, + hashmap! { + global_address => hashmap!( + "name".to_string() => MetadataValue::Bool(true), + ) + } + ) +} + +#[test] +fn extraction_of_non_fungible_data_from_receipts_succeeds() { + // Arrange + let mut test_runner = TestRunner::builder().without_trace().build(); + let (_, _, account) = test_runner.new_account(false); + + // Act + let manifest = ManifestBuilder::new() + .create_non_fungible_resource( + OwnerRole::None, + NonFungibleIdType::Integer, + true, + NonFungibleResourceRoles::default(), + metadata! { + init { + "name" => true, locked; + } + }, + Some(btreemap!( + NonFungibleLocalId::integer(1) => Owl { + name: "an example name".to_string(), + age: 100, + country: "Japan".to_string() + }, + NonFungibleLocalId::integer(2) => Owl { + name: "a second example".to_string(), + age: 100, + country: "Canada".to_string() + }, + )), + ) + .try_deposit_batch_or_abort(account) + .build(); + let receipt = test_runner.execute_manifest_ignoring_fee(manifest, vec![]); + let new_non_fungibles = + radix_engine_toolkit_core::utils::data_of_newly_minted_non_fungibles(&receipt); + + // Assert + let non_fungible_data = new_non_fungibles.expect("Cant be none"); + let resource_address = *receipt + .expect_commit_success() + .new_resource_addresses() + .get(0) + .unwrap(); + assert_eq!( + non_fungible_data, + hashmap! { + resource_address => hashmap! { + NonFungibleLocalId::integer(1) => ScryptoValue::Tuple { + fields: vec![ + ScryptoValue::String { + value: "an example name".to_string(), + }, + ScryptoValue::U32 { value: 100 }, + ScryptoValue::String { + value: "Japan".to_string(), + }, + ], + }, + NonFungibleLocalId::integer(2) => ScryptoValue::Tuple { + fields: vec![ + ScryptoValue::String { + value: "a second example".to_string(), + }, + ScryptoValue::U32 { value: 100 }, + ScryptoValue::String { + value: "Canada".to_string(), + }, + ], + }, + } + } + ); +} + +#[derive(NonFungibleData, ScryptoSbor, ManifestSbor)] +struct Owl { + name: String, + age: u32, + country: String, +} diff --git a/radix-engine-toolkit-uniffi/Cargo.toml b/radix-engine-toolkit-uniffi/Cargo.toml new file mode 100644 index 00000000..329931f7 --- /dev/null +++ b/radix-engine-toolkit-uniffi/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "radix-engine-toolkit-uniffi" +version = "0.10.0-elm.1" +edition = "2021" +build = "build.rs" + +[dependencies] +# radixdlt-scrypto dependencies. +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e" } +radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", default-features= false, features = ["std", "lru"] } +radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } + +# Core Radix Engine Toolkit +radix-engine-toolkit-core = { path = "../radix-engine-toolkit-core" } + +# The UniFFI crate for generating bindings to other languages +uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "fe0d47ab23267415d118e5318feb282cc99ed5d0", features = ["cli"] } +hex = "0.4.3" +thiserror = "1.0.40" +paste = "1.0.12" + +[build-dependencies] +# The UniFFI crate for generating bindings to other languages +uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "fe0d47ab23267415d118e5318feb282cc99ed5d0", features = ["build"] } + +[dev-dependencies] +# The UniFFI crate for generating bindings to other languages +uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "fe0d47ab23267415d118e5318feb282cc99ed5d0", features = ["bindgen-tests"] } + +[lib] +crate-type = ["staticlib", "cdylib", "lib"] + +[profile.release] +incremental = false +panic = 'abort' +codegen-units = 1 diff --git a/radix-engine-toolkit-uniffi/build.rs b/radix-engine-toolkit-uniffi/build.rs new file mode 100644 index 00000000..1d0c05ae --- /dev/null +++ b/radix-engine-toolkit-uniffi/build.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 fn main() { + uniffi::generate_scaffolding("src/radix_engine_toolkit_uniffi.udl").unwrap(); +} diff --git a/radix-engine-toolkit-uniffi/rustfmt.toml b/radix-engine-toolkit-uniffi/rustfmt.toml new file mode 100644 index 00000000..a735b984 --- /dev/null +++ b/radix-engine-toolkit-uniffi/rustfmt.toml @@ -0,0 +1,3 @@ +unstable_features = true +wrap_comments = true +comment_width = 100 \ No newline at end of file diff --git a/radix-engine-toolkit-uniffi/src/build/functions.rs b/radix-engine-toolkit-uniffi/src/build/functions.rs new file mode 100644 index 00000000..b0349ed0 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/build/functions.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 crate::prelude::*; + +#[uniffi::export] +pub fn build_information() -> BuildInformation { + core_information().into() +} + +#[derive(Clone, Record)] +pub struct BuildInformation { + pub version: String, + pub scrypto_dependency: DependencyInformation, +} + +#[derive(Clone, Debug, PartialEq, Eq, Enum)] +pub enum DependencyInformation { + Version { value: String }, + Tag { value: String }, + Branch { value: String }, + Rev { value: String }, +} + +impl From for BuildInformation { + fn from(value: CoreBuildInformation) -> Self { + Self { + version: value.version, + scrypto_dependency: match value.scrypto_dependency { + CoreDependencyInformation::Branch(value) => DependencyInformation::Branch { value }, + CoreDependencyInformation::Tag(value) => DependencyInformation::Tag { value }, + CoreDependencyInformation::Rev(value) => DependencyInformation::Rev { value }, + CoreDependencyInformation::Version(value) => { + DependencyInformation::Version { value } + } + }, + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/build/mod.rs b/radix-engine-toolkit-uniffi/src/build/mod.rs new file mode 100644 index 00000000..9d79f07c --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/build/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 functions; diff --git a/radix-engine-toolkit-uniffi/src/common/address.rs b/radix-engine-toolkit-uniffi/src/common/address.rs new file mode 100644 index 00000000..959d72c8 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/common/address.rs @@ -0,0 +1,209 @@ +// 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::prelude::*; + +#[derive(Debug, Clone, Copy, Object, Hash, PartialEq, Eq)] +pub struct Address(pub(crate) NativeNodeId, pub(crate) u8); + +#[uniffi::export] +impl Address { + #[uniffi::constructor] + pub fn new(address: String) -> Result> { + let network_id = core_network_id_from_address_string(&address).ok_or( + RadixEngineToolkitError::FailedToExtractNetwork { + address: address.clone(), + }, + )?; + let network_definition = core_network_definition_from_network_id(network_id); + let bech32_decoder = NativeAddressBech32Decoder::new(&network_definition); + + let (_, bytes) = bech32_decoder + .validate_and_decode(&address) + .map_err(|error| RadixEngineToolkitError::Bech32DecodeError { + error: format!("{error:?}"), + })?; + + Self::from_raw(bytes, network_id) + } + + #[uniffi::constructor] + pub fn from_raw(node_id_bytes: Vec, network_id: u8) -> Result> { + let node_id = node_id_bytes + .try_into() + .map(NativeNodeId) + .map_err(|bytes| RadixEngineToolkitError::InvalidLength { + expected: NativeNodeId::LENGTH as u64, + actual: bytes.len() as u64, + data: bytes, + })?; + + Ok(Arc::new(Self(node_id, network_id))) + } + + #[uniffi::constructor] + pub fn virtual_account_address_from_public_key( + public_key: PublicKey, + network_id: u8, + ) -> Result> { + derive_virtual_account_address_from_public_key(public_key, network_id) + } + + #[uniffi::constructor] + pub fn virtual_identity_address_from_public_key( + public_key: PublicKey, + network_id: u8, + ) -> Result> { + derive_virtual_identity_address_from_public_key(public_key, network_id) + } + + #[uniffi::constructor] + pub fn virtual_account_address_from_olympia_address( + olympia_account_address: Arc, + network_id: u8, + ) -> Result> { + derive_virtual_account_address_from_olympia_account_address( + olympia_account_address, + network_id, + ) + } + + #[uniffi::constructor] + pub fn resource_address_from_olympia_resource_address( + olympia_resource_address: Arc, + network_id: u8, + ) -> Result> { + derive_resource_address_from_olympia_resource_address(olympia_resource_address, network_id) + } + + pub fn network_id(&self) -> u8 { + self.1 + } + + pub fn bytes(&self) -> Vec { + self.0 .0.to_vec() + } + + pub fn address_string(&self) -> String { + let network_definition = core_network_definition_from_network_id(self.1); + let bech32_encoder = NativeAddressBech32Encoder::new(&network_definition); + bech32_encoder.encode(&self.0 .0).unwrap() + } + + pub fn as_str(&self) -> String { + self.address_string() + } + + pub fn entity_type(&self) -> EntityType { + self.0.entity_type().unwrap().into() + } + + pub fn is_global(&self) -> bool { + self.0.entity_type().unwrap().is_global() + } + + pub fn is_internal(&self) -> bool { + self.0.entity_type().unwrap().is_internal() + } + + pub fn is_global_component(&self) -> bool { + self.0.entity_type().unwrap().is_global_component() + } + + pub fn is_global_package(&self) -> bool { + self.0.entity_type().unwrap().is_global_package() + } + + pub fn is_global_consensus_manager(&self) -> bool { + self.0.entity_type().unwrap().is_global_consensus_manager() + } + + pub fn is_global_resource_manager(&self) -> bool { + self.0.entity_type().unwrap().is_global_resource_manager() + } + + pub fn is_global_fungible_resource_manager(&self) -> bool { + self.0 + .entity_type() + .unwrap() + .is_global_fungible_resource_manager() + } + + pub fn is_global_non_fungible_resource_manager(&self) -> bool { + self.0 + .entity_type() + .unwrap() + .is_global_non_fungible_resource_manager() + } + + pub fn is_global_virtual(&self) -> bool { + self.0.entity_type().unwrap().is_global_virtual() + } + + pub fn is_internal_kv_store(&self) -> bool { + self.0.entity_type().unwrap().is_internal_kv_store() + } + + pub fn is_internal_fungible_vault(&self) -> bool { + self.0.entity_type().unwrap().is_internal_fungible_vault() + } + + pub fn is_internal_non_fungible_vault(&self) -> bool { + self.0 + .entity_type() + .unwrap() + .is_internal_non_fungible_vault() + } + + pub fn is_internal_vault(&self) -> bool { + self.0.entity_type().unwrap().is_internal_vault() + } +} + +impl Address { + pub fn from_node_id(node_id: T, network_id: u8) -> Self + where + T: Into, + { + let node_id = Into::::into(node_id); + Self(node_id, network_id) + } +} + +impl TryFrom

for NativeResourceAddress { + type Error = RadixEngineToolkitError; + + fn try_from(value: Address) -> Result { + value.0 .0.try_into().map_err(Into::into) + } +} + +impl TryFrom
for NativeComponentAddress { + type Error = RadixEngineToolkitError; + + fn try_from(value: Address) -> Result { + value.0 .0.try_into().map_err(Into::into) + } +} + +impl TryFrom
for NativePackageAddress { + type Error = RadixEngineToolkitError; + + fn try_from(value: Address) -> Result { + value.0 .0.try_into().map_err(Into::into) + } +} diff --git a/radix-engine-toolkit-uniffi/src/common/decimal.rs b/radix-engine-toolkit-uniffi/src/common/decimal.rs new file mode 100644 index 00000000..9e6273d3 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/common/decimal.rs @@ -0,0 +1,209 @@ +// 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::should_implement_trait)] + +macro_rules! define_uniffi_decimal { + ($type: ty) => { + paste::paste!{ + define_uniffi_decimal!{[<$type>], $crate::prelude::[]} + } + }; + ($ident: ident, $native_type: ty) => { + paste::paste! { + #[derive(Clone, Debug, crate::prelude::Object, Default)] + pub struct $ident(pub(crate) $native_type); + + #[uniffi::export] + impl $ident { + #[uniffi::constructor] + pub fn new(value: String) -> $crate::prelude::Result<$crate::prelude::Arc> { + value.parse().map(|value| $crate::prelude::Arc::new(Self(value))).map_err(Into::into) + } + + #[uniffi::constructor] + pub fn max() -> crate::prelude::Arc { + $crate::prelude::Arc::new(Self($native_type::MAX)) + } + + #[uniffi::constructor] + pub fn min() -> crate::prelude::Arc { + $crate::prelude::Arc::new(Self($native_type::MIN)) + } + + #[uniffi::constructor] + pub fn zero() -> crate::prelude::Arc { + $crate::prelude::Arc::new(Self($native_type::zero())) + } + + #[uniffi::constructor] + pub fn one() -> crate::prelude::Arc { + $crate::prelude::Arc::new(Self($native_type::one())) + } + + pub fn add(&self, other: $crate::prelude::Arc) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0 + other.0)) + } + + pub fn sub(&self, other: $crate::prelude::Arc) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0 - other.0)) + } + + pub fn mul(&self, other: $crate::prelude::Arc) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0 * other.0)) + } + + pub fn div(&self, other: $crate::prelude::Arc) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0 / other.0)) + } + + pub fn as_str(&self) -> String { + self.0.to_string() + } + + pub fn is_zero(&self) -> bool { + self.0.is_zero() + } + + pub fn is_positive(&self) -> bool { + self.0.is_positive() + } + + pub fn is_negative(&self) -> bool { + self.0.is_negative() + } + + pub fn abs(&self) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0.abs())) + } + + pub fn floor(&self) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0.floor())) + } + + pub fn ceiling(&self) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0.ceiling())) + } + + pub fn round(&self, decimal_places: i32, rounding_mode: crate::prelude::RoundingMode) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0.round(decimal_places, rounding_mode.into()))) + } + + pub fn powi(&self, exp: i64) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0.powi(exp))) + } + + pub fn sqrt(&self) -> Option<$crate::prelude::Arc> { + self.0.sqrt().map(|value| $crate::prelude::Arc::new(Self(value))) + } + + pub fn cbrt(&self) -> $crate::prelude::Arc { + $crate::prelude::Arc::new(Self(self.0.cbrt())) + } + + pub fn nth_root(&self, n: u32) -> Option<$crate::prelude::Arc> { + self.0.nth_root(n).map(|value| $crate::prelude::Arc::new(Self(value))) + } + + pub fn equal(&self, other: $crate::prelude::Arc) -> bool { + self.0.eq(&other.0) + } + + pub fn not_equal(&self, other: $crate::prelude::Arc) -> bool { + self.0.ne(&other.0) + } + + pub fn greater_than(&self, other: $crate::prelude::Arc) -> bool { + self.0.gt(&other.0) + } + + pub fn greater_than_or_equal(&self, other: $crate::prelude::Arc) -> bool { + self.0.ge(&other.0) + } + + pub fn less_than(&self, other: $crate::prelude::Arc) -> bool { + self.0.lt(&other.0) + } + + pub fn less_than_or_equal(&self, other: $crate::prelude::Arc) -> bool { + self.0.le(&other.0) + } + } + } + } +} +define_uniffi_decimal!(Decimal); +define_uniffi_decimal!(PreciseDecimal); + +#[derive(Clone, Debug, crate::prelude::Enum)] +pub enum RoundingMode { + ToPositiveInfinity, + ToNegativeInfinity, + ToZero, + AwayFromZero, + ToNearestMidpointTowardZero, + ToNearestMidpointAwayFromZero, + ToNearestMidpointToEven, +} + +impl From for crate::prelude::NativeRoundingMode { + fn from(value: RoundingMode) -> Self { + match value { + RoundingMode::ToPositiveInfinity => { + crate::prelude::NativeRoundingMode::ToPositiveInfinity + } + RoundingMode::ToNegativeInfinity => { + crate::prelude::NativeRoundingMode::ToNegativeInfinity + } + RoundingMode::ToZero => crate::prelude::NativeRoundingMode::ToZero, + RoundingMode::AwayFromZero => crate::prelude::NativeRoundingMode::AwayFromZero, + RoundingMode::ToNearestMidpointTowardZero => { + crate::prelude::NativeRoundingMode::ToNearestMidpointTowardZero + } + RoundingMode::ToNearestMidpointAwayFromZero => { + crate::prelude::NativeRoundingMode::ToNearestMidpointAwayFromZero + } + RoundingMode::ToNearestMidpointToEven => { + crate::prelude::NativeRoundingMode::ToNearestMidpointToEven + } + } + } +} + +impl From for RoundingMode { + fn from(value: crate::prelude::NativeRoundingMode) -> Self { + match value { + crate::prelude::NativeRoundingMode::ToPositiveInfinity => { + RoundingMode::ToPositiveInfinity + } + crate::prelude::NativeRoundingMode::ToNegativeInfinity => { + RoundingMode::ToNegativeInfinity + } + crate::prelude::NativeRoundingMode::ToZero => RoundingMode::ToZero, + crate::prelude::NativeRoundingMode::AwayFromZero => RoundingMode::AwayFromZero, + crate::prelude::NativeRoundingMode::ToNearestMidpointTowardZero => { + RoundingMode::ToNearestMidpointTowardZero + } + crate::prelude::NativeRoundingMode::ToNearestMidpointAwayFromZero => { + RoundingMode::ToNearestMidpointAwayFromZero + } + crate::prelude::NativeRoundingMode::ToNearestMidpointToEven => { + RoundingMode::ToNearestMidpointToEven + } + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/common/entity_type.rs b/radix-engine-toolkit-uniffi/src/common/entity_type.rs new file mode 100644 index 00000000..d5f76573 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/common/entity_type.rs @@ -0,0 +1,106 @@ +// 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::prelude::*; + +#[derive(Clone, Copy, Debug, Enum, Hash, PartialEq, Eq)] +pub enum EntityType { + GlobalPackage, + GlobalFungibleResourceManager, + GlobalNonFungibleResourceManager, + GlobalConsensusManager, + GlobalValidator, + GlobalAccessController, + GlobalAccount, + GlobalIdentity, + GlobalGenericComponent, + GlobalVirtualSecp256k1Account, + GlobalVirtualEd25519Account, + GlobalVirtualSecp256k1Identity, + GlobalVirtualEd25519Identity, + GlobalOneResourcePool, + GlobalTwoResourcePool, + GlobalMultiResourcePool, + GlobalTransactionTracker, + InternalFungibleVault, + InternalNonFungibleVault, + InternalAccount, + InternalGenericComponent, + InternalKeyValueStore, +} + +impl From for NativeEntityType { + fn from(value: EntityType) -> Self { + match value { + EntityType::GlobalPackage => Self::GlobalPackage, + EntityType::GlobalFungibleResourceManager => Self::GlobalFungibleResourceManager, + EntityType::GlobalNonFungibleResourceManager => Self::GlobalNonFungibleResourceManager, + EntityType::GlobalConsensusManager => Self::GlobalConsensusManager, + EntityType::GlobalValidator => Self::GlobalValidator, + EntityType::GlobalAccessController => Self::GlobalAccessController, + EntityType::GlobalAccount => Self::GlobalAccount, + EntityType::GlobalIdentity => Self::GlobalIdentity, + EntityType::GlobalGenericComponent => Self::GlobalGenericComponent, + EntityType::GlobalVirtualSecp256k1Account => Self::GlobalVirtualSecp256k1Account, + EntityType::GlobalVirtualEd25519Account => Self::GlobalVirtualEd25519Account, + EntityType::GlobalVirtualSecp256k1Identity => Self::GlobalVirtualSecp256k1Identity, + EntityType::GlobalVirtualEd25519Identity => Self::GlobalVirtualEd25519Identity, + EntityType::GlobalOneResourcePool => Self::GlobalOneResourcePool, + EntityType::GlobalTwoResourcePool => Self::GlobalTwoResourcePool, + EntityType::GlobalMultiResourcePool => Self::GlobalMultiResourcePool, + EntityType::GlobalTransactionTracker => Self::GlobalTransactionTracker, + EntityType::InternalFungibleVault => Self::InternalFungibleVault, + EntityType::InternalNonFungibleVault => Self::InternalNonFungibleVault, + EntityType::InternalAccount => Self::InternalAccount, + EntityType::InternalGenericComponent => Self::InternalGenericComponent, + EntityType::InternalKeyValueStore => Self::InternalKeyValueStore, + } + } +} + +impl From for EntityType { + fn from(value: NativeEntityType) -> Self { + match value { + NativeEntityType::GlobalPackage => Self::GlobalPackage, + NativeEntityType::GlobalFungibleResourceManager => Self::GlobalFungibleResourceManager, + NativeEntityType::GlobalNonFungibleResourceManager => { + Self::GlobalNonFungibleResourceManager + } + NativeEntityType::GlobalConsensusManager => Self::GlobalConsensusManager, + NativeEntityType::GlobalValidator => Self::GlobalValidator, + NativeEntityType::GlobalAccessController => Self::GlobalAccessController, + NativeEntityType::GlobalAccount => Self::GlobalAccount, + NativeEntityType::GlobalIdentity => Self::GlobalIdentity, + NativeEntityType::GlobalGenericComponent => Self::GlobalGenericComponent, + NativeEntityType::GlobalVirtualSecp256k1Account => Self::GlobalVirtualSecp256k1Account, + NativeEntityType::GlobalVirtualEd25519Account => Self::GlobalVirtualEd25519Account, + NativeEntityType::GlobalVirtualSecp256k1Identity => { + Self::GlobalVirtualSecp256k1Identity + } + NativeEntityType::GlobalVirtualEd25519Identity => Self::GlobalVirtualEd25519Identity, + NativeEntityType::GlobalOneResourcePool => Self::GlobalOneResourcePool, + NativeEntityType::GlobalTwoResourcePool => Self::GlobalTwoResourcePool, + NativeEntityType::GlobalMultiResourcePool => Self::GlobalMultiResourcePool, + NativeEntityType::GlobalTransactionTracker => Self::GlobalTransactionTracker, + NativeEntityType::InternalFungibleVault => Self::InternalFungibleVault, + NativeEntityType::InternalNonFungibleVault => Self::InternalNonFungibleVault, + NativeEntityType::InternalAccount => Self::InternalAccount, + NativeEntityType::InternalGenericComponent => Self::InternalGenericComponent, + NativeEntityType::InternalKeyValueStore => Self::InternalKeyValueStore, + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/common/metadata.rs b/radix-engine-toolkit-uniffi/src/common/metadata.rs new file mode 100644 index 00000000..e2a97cf1 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/common/metadata.rs @@ -0,0 +1,231 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Enum)] +pub enum MetadataValue { + StringValue { + value: String, + }, + BoolValue { + value: bool, + }, + U8Value { + value: u8, + }, + U32Value { + value: u32, + }, + U64Value { + value: u64, + }, + I32Value { + value: i32, + }, + I64Value { + value: i64, + }, + DecimalValue { + value: Arc, + }, + GlobalAddressValue { + value: Arc
, + }, + PublicKeyValue { + value: PublicKey, + }, + NonFungibleGlobalIdValue { + value: Arc, + }, + NonFungibleLocalIdValue { + value: NonFungibleLocalId, + }, + InstantValue { + value: i64, + }, + UrlValue { + value: String, + }, + OriginValue { + value: String, + }, + PublicKeyHashValue { + value: PublicKeyHash, + }, + + StringArrayValue { + value: Vec, + }, + BoolArrayValue { + value: Vec, + }, + U8ArrayValue { + value: Vec, + }, + U32ArrayValue { + value: Vec, + }, + U64ArrayValue { + value: Vec, + }, + I32ArrayValue { + value: Vec, + }, + I64ArrayValue { + value: Vec, + }, + DecimalArrayValue { + value: Vec>, + }, + GlobalAddressArrayValue { + value: Vec>, + }, + PublicKeyArrayValue { + value: Vec, + }, + NonFungibleGlobalIdArrayValue { + value: Vec>, + }, + NonFungibleLocalIdArrayValue { + value: Vec, + }, + InstantArrayValue { + value: Vec, + }, + UrlArrayValue { + value: Vec, + }, + OriginArrayValue { + value: Vec, + }, + PublicKeyHashArrayValue { + value: Vec, + }, +} + +impl MetadataValue { + pub fn from_native(native: &NativeMetadataValue, network_id: u8) -> Self { + match native.clone() { + NativeMetadataValue::String(value) => Self::StringValue { value }, + NativeMetadataValue::Bool(value) => Self::BoolValue { value }, + + NativeMetadataValue::U8(value) => Self::U8Value { value }, + NativeMetadataValue::U32(value) => Self::U32Value { value }, + NativeMetadataValue::U64(value) => Self::U64Value { value }, + NativeMetadataValue::I32(value) => Self::I32Value { value }, + NativeMetadataValue::I64(value) => Self::I64Value { value }, + + NativeMetadataValue::Decimal(value) => Self::DecimalValue { + value: Arc::new(Decimal(value)), + }, + NativeMetadataValue::GlobalAddress(value) => Self::GlobalAddressValue { + value: Arc::new(Address(value.into(), network_id)), + }, + NativeMetadataValue::PublicKey(value) => Self::PublicKeyValue { + value: value.into(), + }, + NativeMetadataValue::PublicKeyHash(value) => Self::PublicKeyHashValue { + value: value.into(), + }, + NativeMetadataValue::NonFungibleGlobalId(value) => Self::NonFungibleGlobalIdValue { + value: Arc::new(NonFungibleGlobalId(value, network_id)), + }, + NativeMetadataValue::NonFungibleLocalId(value) => Self::NonFungibleLocalIdValue { + value: value.into(), + }, + NativeMetadataValue::Instant(value) => Self::InstantValue { + value: value.seconds_since_unix_epoch, + }, + NativeMetadataValue::Url(value) => Self::UrlValue { value: value.0 }, + NativeMetadataValue::Origin(value) => Self::OriginValue { value: value.0 }, + + NativeMetadataValue::StringArray(value) => Self::StringArrayValue { value }, + NativeMetadataValue::BoolArray(value) => Self::BoolArrayValue { value }, + + NativeMetadataValue::U8Array(value) => Self::U8ArrayValue { value }, + NativeMetadataValue::U32Array(value) => Self::U32ArrayValue { value }, + NativeMetadataValue::U64Array(value) => Self::U64ArrayValue { value }, + NativeMetadataValue::I32Array(value) => Self::I32ArrayValue { value }, + NativeMetadataValue::I64Array(value) => Self::I64ArrayValue { value }, + + NativeMetadataValue::DecimalArray(value) => Self::DecimalArrayValue { + value: value + .into_iter() + .map(|value| Arc::new(Decimal(value))) + .collect(), + }, + NativeMetadataValue::GlobalAddressArray(value) => Self::GlobalAddressArrayValue { + value: value + .into_iter() + .map(|value| Arc::new(Address(value.into(), network_id))) + .collect(), + }, + NativeMetadataValue::PublicKeyArray(value) => Self::PublicKeyArrayValue { + value: value.into_iter().map(Into::into).collect(), + }, + NativeMetadataValue::PublicKeyHashArray(value) => Self::PublicKeyHashArrayValue { + value: value.into_iter().map(Into::into).collect(), + }, + NativeMetadataValue::NonFungibleGlobalIdArray(value) => { + Self::NonFungibleGlobalIdArrayValue { + value: value + .into_iter() + .map(|value| Arc::new(NonFungibleGlobalId(value, network_id))) + .collect(), + } + } + NativeMetadataValue::NonFungibleLocalIdArray(value) => { + Self::NonFungibleLocalIdArrayValue { + value: value.into_iter().map(Into::into).collect(), + } + } + NativeMetadataValue::InstantArray(value) => Self::InstantArrayValue { + value: value + .into_iter() + .map(|value| value.seconds_since_unix_epoch) + .collect(), + }, + NativeMetadataValue::UrlArray(value) => Self::UrlArrayValue { + value: value.into_iter().map(|value| value.0).collect(), + }, + NativeMetadataValue::OriginArray(value) => Self::OriginArrayValue { + value: value.into_iter().map(|value| value.0).collect(), + }, + } + } +} + +// ================== +// Exposed "Methods" +// ================== + +#[uniffi::export] +pub fn sbor_decode_to_metadata_value(bytes: Vec, network_id: u8) -> Result { + let native = match bytes.first().copied() { + Some(NATIVE_SCRYPTO_SBOR_V1_PAYLOAD_PREFIX) => { + native_scrypto_decode::(&bytes).map_err(Into::into) + } + Some(NATIVE_MANIFEST_SBOR_V1_PAYLOAD_PREFIX) => { + native_manifest_decode::(&bytes).map_err(Into::into) + } + v => Err(RadixEngineToolkitError::DecodeError { + error: format!("Invalid index byte: {v:?}"), + }), + }?; + Ok(MetadataValue::from_native(&native, network_id)) +} diff --git a/radix-engine-toolkit-uniffi/src/common/mod.rs b/radix-engine-toolkit-uniffi/src/common/mod.rs new file mode 100644 index 00000000..014b7e8b --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/common/mod.rs @@ -0,0 +1,23 @@ +// 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 decimal; +pub mod entity_type; +pub mod metadata; +pub mod non_fungible; +pub mod olympia; diff --git a/radix-engine-toolkit-uniffi/src/common/non_fungible.rs b/radix-engine-toolkit-uniffi/src/common/non_fungible.rs new file mode 100644 index 00000000..617f1e79 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/common/non_fungible.rs @@ -0,0 +1,144 @@ +// 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::prelude::*; + +#[derive(Debug, Clone, Object)] +pub struct NonFungibleGlobalId(pub(crate) NativeNonFungibleGlobalId, pub(crate) u8); + +#[uniffi::export] +impl NonFungibleGlobalId { + #[uniffi::constructor] + pub fn new(non_fungible_global_id: String) -> Result> { + let network_id = non_fungible_global_id + .split(':') + .next() + .and_then(core_network_id_from_address_string) + .ok_or(RadixEngineToolkitError::ParseError { + type_name: "scrypto::prelude::NonFungibleGlobalId".to_owned(), + error: "Failed to obtain network id from non-fungible global id".to_owned(), + })?; + let network_definition = core_network_definition_from_network_id(network_id); + let bech32_decoder = NativeAddressBech32Decoder::new(&network_definition); + + let non_fungible_global_id = NativeNonFungibleGlobalId::try_from_canonical_string( + &bech32_decoder, + &non_fungible_global_id, + )?; + Ok(Arc::new(Self(non_fungible_global_id, network_id))) + } + + #[uniffi::constructor] + pub fn from_parts( + resource_address: Arc
, + non_fungible_local_id: NonFungibleLocalId, + ) -> Result> { + match resource_address.entity_type() { + EntityType::GlobalNonFungibleResourceManager => Ok(()), + actual => Err(RadixEngineToolkitError::EntityTypeMismatchError { + expected: vec![EntityType::GlobalNonFungibleResourceManager], + actual, + }), + }?; + let network_id = resource_address.1; + let resource_address = NativeResourceAddress::new_or_panic(resource_address.0 .0); + let non_fungible_local_id = NativeNonFungibleLocalId::try_from(non_fungible_local_id)?; + + Ok(Arc::new(Self( + NativeNonFungibleGlobalId::new(resource_address, non_fungible_local_id), + network_id, + ))) + } + + #[uniffi::constructor] + pub fn virtual_signature_badge(public_key: PublicKey, network_id: u8) -> Result> { + derive_virtual_signature_non_fungible_global_id_from_public_key(public_key, network_id) + } + + pub fn resource_address(&self) -> Arc
{ + let address = self.0.resource_address(); + let node_id = address.as_node_id(); + Arc::new(Address(*node_id, self.1)) + } + + pub fn local_id(&self) -> NonFungibleLocalId { + self.0.local_id().clone().into() + } + + pub fn as_str(&self) -> String { + let network_id = self.1; + let network_definition = core_network_definition_from_network_id(network_id); + let bech32_encoder = NativeAddressBech32Encoder::new(&network_definition); + self.0.to_canonical_string(&bech32_encoder) + } +} + +#[derive(Clone, Debug, Enum, Hash, PartialEq, Eq)] +pub enum NonFungibleLocalId { + Integer { value: u64 }, + Str { value: String }, + Bytes { value: Vec }, + Ruid { value: Vec }, +} + +impl From for NonFungibleLocalId { + fn from(value: NativeNonFungibleLocalId) -> Self { + match value { + NativeNonFungibleLocalId::String(value) => Self::Str { + value: value.value().to_owned(), + }, + NativeNonFungibleLocalId::Integer(value) => Self::Integer { + value: value.value(), + }, + NativeNonFungibleLocalId::Bytes(value) => Self::Bytes { + value: value.value().to_vec(), + }, + NativeNonFungibleLocalId::RUID(value) => Self::Ruid { + value: value.value().to_vec(), + }, + } + } +} + +impl TryFrom for NativeNonFungibleLocalId { + type Error = RadixEngineToolkitError; + + fn try_from(value: NonFungibleLocalId) -> Result { + match value { + NonFungibleLocalId::Str { value } => Self::string(value).map_err(Into::into), + NonFungibleLocalId::Bytes { value } => Self::bytes(value).map_err(Into::into), + NonFungibleLocalId::Ruid { value } => { + value.try_into().map(Self::ruid).map_err(|value| { + RadixEngineToolkitError::InvalidLength { + expected: 32, + actual: value.len() as u64, + data: value, + } + }) + } + NonFungibleLocalId::Integer { value } => Ok(Self::integer(value)), + } + } +} + +impl std::str::FromStr for NonFungibleLocalId { + type Err = ::Err; + + fn from_str(s: &str) -> std::result::Result { + NativeNonFungibleLocalId::from_str(s).map(Into::into) + } +} diff --git a/radix-engine-toolkit-uniffi/src/common/olympia.rs b/radix-engine-toolkit-uniffi/src/common/olympia.rs new file mode 100644 index 00000000..cd07fbff --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/common/olympia.rs @@ -0,0 +1,79 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Object)] +pub struct OlympiaAddress(pub(crate) String); + +#[uniffi::export] +impl OlympiaAddress { + #[uniffi::constructor] + pub fn new(address: String) -> Arc { + Arc::new(Self(address)) + } + + pub fn as_str(&self) -> String { + self.0.clone() + } + + pub fn public_key(&self) -> Result { + derive_public_key_from_olympia_account_address(Arc::new(self.clone())) + } +} + +#[derive(Clone, Debug, Enum)] +pub enum OlympiaNetwork { + Mainnet, + Stokenet, + Releasenet, + RCNet, + Milestonenet, + Devopsnet, + Sandpitnet, + Localnet, +} + +impl From for OlympiaNetwork { + fn from(value: CoreOlympiaNetwork) -> Self { + match value { + CoreOlympiaNetwork::Mainnet => Self::Mainnet, + CoreOlympiaNetwork::Stokenet => Self::Stokenet, + CoreOlympiaNetwork::Releasenet => Self::Releasenet, + CoreOlympiaNetwork::RCNet => Self::RCNet, + CoreOlympiaNetwork::Milestonenet => Self::Milestonenet, + CoreOlympiaNetwork::Devopsnet => Self::Devopsnet, + CoreOlympiaNetwork::Sandpitnet => Self::Sandpitnet, + CoreOlympiaNetwork::Localnet => Self::Localnet, + } + } +} + +impl From for CoreOlympiaNetwork { + fn from(value: OlympiaNetwork) -> Self { + match value { + OlympiaNetwork::Mainnet => Self::Mainnet, + OlympiaNetwork::Stokenet => Self::Stokenet, + OlympiaNetwork::Releasenet => Self::Releasenet, + OlympiaNetwork::RCNet => Self::RCNet, + OlympiaNetwork::Milestonenet => Self::Milestonenet, + OlympiaNetwork::Devopsnet => Self::Devopsnet, + OlympiaNetwork::Sandpitnet => Self::Sandpitnet, + OlympiaNetwork::Localnet => Self::Localnet, + } + } +} diff --git a/radix-engine-toolkit/src/model/value/scrypto_sbor/mod.rs b/radix-engine-toolkit-uniffi/src/cryptography/curve.rs similarity index 88% rename from radix-engine-toolkit/src/model/value/scrypto_sbor/mod.rs rename to radix-engine-toolkit-uniffi/src/cryptography/curve.rs index d592a121..743fa8fc 100644 --- a/radix-engine-toolkit/src/model/value/scrypto_sbor/mod.rs +++ b/radix-engine-toolkit-uniffi/src/cryptography/curve.rs @@ -15,8 +15,10 @@ // specific language governing permissions and limitations // under the License. -pub mod bridge; -pub mod model; +use crate::prelude::*; -pub use bridge::*; -pub use model::*; +#[derive(Clone, Copy, Debug, Enum)] +pub enum Curve { + Secp256k1, + Ed25519, +} diff --git a/radix-engine-toolkit-uniffi/src/cryptography/hash.rs b/radix-engine-toolkit-uniffi/src/cryptography/hash.rs new file mode 100644 index 00000000..1e3533dc --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/cryptography/hash.rs @@ -0,0 +1,67 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Object, Copy)] +pub struct Hash(pub(crate) NativeHash); + +#[uniffi::export] +impl Hash { + #[uniffi::constructor] + pub fn new(hash: Vec) -> Result> { + hash.try_into() + .map(|value| Arc::new(Self(NativeHash(value)))) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeHash::LENGTH as u64, + actual: value.len() as u64, + data: value, + }) + } + + #[uniffi::constructor] + pub fn from_hex_string(hash: String) -> Result> { + hash.parse() + .map(|value| Arc::new(Self(value))) + .map_err(Into::into) + } + + #[uniffi::constructor] + pub fn from_unhashed_bytes(bytes: Vec) -> Arc { + Arc::new(Self(native_hash(bytes))) + } + + pub fn bytes(&self) -> Vec { + self.0.to_vec() + } + + pub fn as_str(&self) -> String { + self.0.to_string() + } +} + +impl From for Hash { + fn from(value: NativeHash) -> Self { + Self(value) + } +} + +impl From for NativeHash { + fn from(value: Hash) -> Self { + value.0 + } +} diff --git a/radix-engine-toolkit/src/model/crypto/mod.rs b/radix-engine-toolkit-uniffi/src/cryptography/mod.rs similarity index 91% rename from radix-engine-toolkit/src/model/crypto/mod.rs rename to radix-engine-toolkit-uniffi/src/cryptography/mod.rs index 953320a9..9cf98d7c 100644 --- a/radix-engine-toolkit/src/model/crypto/mod.rs +++ b/radix-engine-toolkit-uniffi/src/cryptography/mod.rs @@ -15,10 +15,8 @@ // specific language governing permissions and limitations // under the License. +pub mod hash; pub mod public_key; +pub mod public_key_hash; pub mod signature; pub mod signature_with_public_key; - -pub use public_key::*; -pub use signature::*; -pub use signature_with_public_key::*; diff --git a/radix-engine-toolkit-uniffi/src/cryptography/public_key.rs b/radix-engine-toolkit-uniffi/src/cryptography/public_key.rs new file mode 100644 index 00000000..5165b478 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/cryptography/public_key.rs @@ -0,0 +1,122 @@ +// 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::prelude::*; + +#[derive(Clone, Enum, Debug)] +pub enum PublicKey { + Secp256k1 { value: Vec }, + Ed25519 { value: Vec }, +} + +#[derive(Clone, Record, Debug)] +pub struct Ed25519PublicKey { + value: Vec, +} + +#[derive(Clone, Record, Debug)] +pub struct Secp256k1PublicKey { + value: Vec, +} + +impl From for PublicKey { + fn from(value: NativePublicKey) -> Self { + match value { + NativePublicKey::Secp256k1(NativeSecp256k1PublicKey(value)) => Self::Secp256k1 { + value: value.to_vec(), + }, + NativePublicKey::Ed25519(NativeEd25519PublicKey(value)) => Self::Ed25519 { + value: value.to_vec(), + }, + } + } +} + +impl TryFrom for NativePublicKey { + type Error = RadixEngineToolkitError; + + fn try_from(value: PublicKey) -> Result { + match value { + PublicKey::Ed25519 { value } => value + .try_into() + .map(NativeEd25519PublicKey) + .map(Self::Ed25519) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeEd25519PublicKey::LENGTH as u64, + actual: value.len() as u64, + data: value, + }), + PublicKey::Secp256k1 { value } => value + .try_into() + .map(NativeSecp256k1PublicKey) + .map(Self::Secp256k1) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeSecp256k1PublicKey::LENGTH as u64, + actual: value.len() as u64, + data: value, + }), + } + } +} + +impl From for Ed25519PublicKey { + fn from(value: NativeEd25519PublicKey) -> Self { + Self { + value: value.0.to_vec(), + } + } +} + +impl TryFrom for NativeEd25519PublicKey { + type Error = RadixEngineToolkitError; + + fn try_from(value: Ed25519PublicKey) -> Result { + value + .value + .try_into() + .map(NativeEd25519PublicKey) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeSecp256k1PublicKey::LENGTH as u64, + actual: value.len() as u64, + data: value, + }) + } +} + +impl From for Secp256k1PublicKey { + fn from(value: NativeSecp256k1PublicKey) -> Self { + Self { + value: value.0.to_vec(), + } + } +} + +impl TryFrom for NativeSecp256k1PublicKey { + type Error = RadixEngineToolkitError; + + fn try_from(value: Secp256k1PublicKey) -> Result { + value + .value + .try_into() + .map(NativeSecp256k1PublicKey) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeSecp256k1PublicKey::LENGTH as u64, + actual: value.len() as u64, + data: value, + }) + } +} diff --git a/radix-engine-toolkit-uniffi/src/cryptography/public_key_hash.rs b/radix-engine-toolkit-uniffi/src/cryptography/public_key_hash.rs new file mode 100644 index 00000000..cdb57189 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/cryptography/public_key_hash.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 crate::prelude::*; + +#[derive(Clone, Debug, Enum)] +pub enum PublicKeyHash { + Secp256k1 { value: Vec }, + Ed25519 { value: Vec }, +} + +impl From for PublicKeyHash { + fn from(value: NativePublicKeyHash) -> Self { + match value { + NativePublicKeyHash::Secp256k1(NativeSecp256k1PublicKeyHash(value)) => { + Self::Secp256k1 { + value: value.to_vec(), + } + } + NativePublicKeyHash::Ed25519(NativeEd25519PublicKeyHash(value)) => Self::Ed25519 { + value: value.to_vec(), + }, + } + } +} + +impl TryFrom for NativePublicKeyHash { + type Error = RadixEngineToolkitError; + + fn try_from(value: PublicKeyHash) -> Result { + match value { + PublicKeyHash::Ed25519 { value } => value + .try_into() + .map(NativeEd25519PublicKeyHash) + .map(Self::Ed25519) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeNodeId::RID_LENGTH as u64, + actual: value.len() as u64, + data: value, + }), + PublicKeyHash::Secp256k1 { value } => value + .try_into() + .map(NativeSecp256k1PublicKeyHash) + .map(Self::Secp256k1) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeNodeId::RID_LENGTH as u64, + actual: value.len() as u64, + data: value, + }), + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/cryptography/signature.rs b/radix-engine-toolkit-uniffi/src/cryptography/signature.rs new file mode 100644 index 00000000..00eb0c30 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/cryptography/signature.rs @@ -0,0 +1,64 @@ +// 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::prelude::*; + +#[derive(Clone, Enum, Debug)] +pub enum Signature { + Secp256k1 { value: Vec }, + Ed25519 { value: Vec }, +} + +impl From for Signature { + fn from(value: NativeSignature) -> Self { + match value { + NativeSignature::Secp256k1(NativeSecp256k1Signature(value)) => Self::Secp256k1 { + value: value.to_vec(), + }, + NativeSignature::Ed25519(NativeEd25519Signature(value)) => Self::Ed25519 { + value: value.to_vec(), + }, + } + } +} + +impl TryFrom for NativeSignature { + type Error = RadixEngineToolkitError; + + fn try_from(value: Signature) -> Result { + match value { + Signature::Ed25519 { value } => value + .try_into() + .map(NativeEd25519Signature) + .map(Self::Ed25519) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeEd25519Signature::LENGTH as u64, + actual: value.len() as u64, + data: value, + }), + Signature::Secp256k1 { value } => value + .try_into() + .map(NativeSecp256k1Signature) + .map(Self::Secp256k1) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeSecp256k1Signature::LENGTH as u64, + actual: value.len() as u64, + data: value, + }), + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/cryptography/signature_with_public_key.rs b/radix-engine-toolkit-uniffi/src/cryptography/signature_with_public_key.rs new file mode 100644 index 00000000..35b0f266 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/cryptography/signature_with_public_key.rs @@ -0,0 +1,93 @@ +// 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::prelude::*; + +#[derive(Clone, Enum, Debug)] +pub enum SignatureWithPublicKey { + Secp256k1 { + signature: Vec, + }, + Ed25519 { + signature: Vec, + public_key: Vec, + }, +} + +impl From for SignatureWithPublicKey { + fn from(value: NativeSignatureWithPublicKey) -> Self { + match value { + NativeSignatureWithPublicKey::Secp256k1 { + signature: NativeSecp256k1Signature(signature), + } => Self::Secp256k1 { + signature: signature.to_vec(), + }, + NativeSignatureWithPublicKey::Ed25519 { + signature: NativeEd25519Signature(signature), + public_key: NativeEd25519PublicKey(public_key), + } => Self::Ed25519 { + signature: signature.to_vec(), + public_key: public_key.to_vec(), + }, + } + } +} + +impl TryFrom for NativeSignatureWithPublicKey { + type Error = RadixEngineToolkitError; + + fn try_from(value: SignatureWithPublicKey) -> Result { + match value { + SignatureWithPublicKey::Ed25519 { + signature, + public_key, + } => { + let public_key = + public_key + .try_into() + .map(NativeEd25519PublicKey) + .map_err(|public_key| RadixEngineToolkitError::InvalidLength { + expected: NativeEd25519PublicKey::LENGTH as u64, + actual: public_key.len() as u64, + data: public_key, + })?; + let signature = + signature + .try_into() + .map(NativeEd25519Signature) + .map_err(|signature| RadixEngineToolkitError::InvalidLength { + expected: NativeEd25519Signature::LENGTH as u64, + actual: signature.len() as u64, + data: signature, + })?; + Ok(Self::Ed25519 { + public_key, + signature, + }) + } + SignatureWithPublicKey::Secp256k1 { signature } => signature + .try_into() + .map(NativeSecp256k1Signature) + .map(|signature| Self::Secp256k1 { signature }) + .map_err(|signature| RadixEngineToolkitError::InvalidLength { + expected: NativeSecp256k1Signature::LENGTH as u64, + actual: signature.len() as u64, + data: signature, + }), + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/derive/functions.rs b/radix-engine-toolkit-uniffi/src/derive/functions.rs new file mode 100644 index 00000000..93c74574 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/derive/functions.rs @@ -0,0 +1,102 @@ +// 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::prelude::*; + +#[uniffi::export] +pub fn derive_virtual_account_address_from_public_key( + public_key: PublicKey, + network_id: u8, +) -> Result> { + let public_key = NativePublicKey::try_from(public_key)?; + let address = NativeComponentAddress::virtual_account_from_public_key(&public_key); + let node_id = address.into_node_id(); + Ok(Arc::new(Address(node_id, network_id))) +} + +#[uniffi::export] +pub fn derive_virtual_identity_address_from_public_key( + public_key: PublicKey, + network_id: u8, +) -> Result> { + let public_key = NativePublicKey::try_from(public_key)?; + let address = NativeComponentAddress::virtual_identity_from_public_key(&public_key); + let node_id = address.into_node_id(); + Ok(Arc::new(Address(node_id, network_id))) +} + +#[uniffi::export] +pub fn derive_virtual_signature_non_fungible_global_id_from_public_key( + public_key: PublicKey, + network_id: u8, +) -> Result> { + let public_key = NativePublicKey::try_from(public_key)?; + let non_fungible_global_id = + core_virtual_signature_non_fungible_global_id_from_public_key(&public_key); + Ok(Arc::new(NonFungibleGlobalId( + non_fungible_global_id, + network_id, + ))) +} + +#[uniffi::export] +pub fn derive_virtual_account_address_from_olympia_account_address( + olympia_account_address: Arc, + network_id: u8, +) -> Result> { + let component_address = + core_virtual_account_address_from_olympia_account_address(&olympia_account_address.0)?; + let node_id = component_address.into_node_id(); + Ok(Arc::new(Address(node_id, network_id))) +} + +#[uniffi::export] +pub fn derive_resource_address_from_olympia_resource_address( + olympia_resource_address: Arc, + network_id: u8, +) -> Result> { + let resource_address = + core_resource_address_from_olympia_resource_address(&olympia_resource_address.0)?; + let node_id = resource_address.into_node_id(); + Ok(Arc::new(Address(node_id, network_id))) +} + +#[uniffi::export] +pub fn derive_public_key_from_olympia_account_address( + olympia_resource_address: Arc, +) -> Result { + core_public_key_from_olympia_account_address(&olympia_resource_address.0) + .map( + |NativeSecp256k1PublicKey(public_key)| PublicKey::Secp256k1 { + value: public_key.to_vec(), + }, + ) + .map_err(Into::into) +} + +#[uniffi::export] +pub fn derive_olympia_account_address_from_public_key( + public_key: PublicKey, + olympia_network: OlympiaNetwork, +) -> Result> { + let public_key = match NativePublicKey::try_from(public_key)? { + NativePublicKey::Secp256k1(pk) => Ok(pk), + NativePublicKey::Ed25519(..) => Err(RadixEngineToolkitError::InvalidPublicKey), + }?; + let address = core_olympia_account_address_from_public_key(&public_key, olympia_network.into()); + Ok(Arc::new(OlympiaAddress(address))) +} diff --git a/radix-engine-toolkit-uniffi/src/derive/mod.rs b/radix-engine-toolkit-uniffi/src/derive/mod.rs new file mode 100644 index 00000000..9d79f07c --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/derive/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 functions; diff --git a/radix-engine-toolkit-uniffi/src/error.rs b/radix-engine-toolkit-uniffi/src/error.rs new file mode 100644 index 00000000..646222f5 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/error.rs @@ -0,0 +1,140 @@ +// 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::prelude::*; + +pub type Result = std::result::Result; + +#[derive(Clone, Debug, Error, ThisError)] +pub enum RadixEngineToolkitError { + #[error("Length check failed.")] + InvalidLength { + expected: u64, + actual: u64, + data: Vec, + }, + + #[error("Failed to derive network id from address string")] + FailedToExtractNetwork { address: String }, + + #[error("Failed to Bech32m decode the address")] + Bech32DecodeError { error: String }, + + #[error("Failed to parse a string into a typed object")] + ParseError { type_name: String, error: String }, + + #[error("Failed to validate content during non-fungible local id conversion")] + NonFungibleContentValidationError { error: String }, + + #[error("Entity type did not match expected")] + EntityTypeMismatchError { + expected: Vec, + actual: EntityType, + }, + + #[error("Failed to perform a derivation")] + DerivationError { error: String }, + + #[error("Public key is not valid for a given operation")] + InvalidPublicKey, + + #[error("Manifest compilation errored out")] + CompileError { error: String }, + + #[error("Manifest decompilation errored out")] + DecompileError { error: String }, + + #[error("Failed while trying to prepare transaction part")] + PrepareError { error: String }, + + #[error("Failed to SBOR encode some data")] + EncodeError { error: String }, + + #[error("Failed to SBOR decode some payload")] + DecodeError { error: String }, + + #[error("Static validation of transaction part has failed")] + TransactionValidationFailed { error: String }, + + #[error("Execution analysis failed")] + ExecutionModuleError { error: String }, + + #[error("An error occurred during doing a Manifest SBOR encode/decode")] + ManifestSborError { error: String }, + + #[error("An error occurred during doing a Scrypto SBOR encode/decode")] + ScryptoSborError { error: String }, +} + +macro_rules! dbg_str { + ($expr: expr) => { + format!("{:?}", $expr) + }; +} + +macro_rules! impl_parse_error { + ( + $type: ty, + $error: ty + ) => { + impl From<$error> for RadixEngineToolkitError { + fn from(value: $error) -> Self { + Self::ParseError { + type_name: stringify!($type).to_owned(), + error: dbg_str!(value), + } + } + } + }; +} + +macro_rules! impl_dbg_str_from { + ($error: ty, $variant: ident) => { + impl From<$error> for RadixEngineToolkitError { + fn from(value: $error) -> Self { + Self::$variant { + error: dbg_str!(value), + } + } + } + }; +} + +impl_parse_error! { scrypto::prelude::Decimal, scrypto::prelude::ParseDecimalError } +impl_parse_error! { scrypto::prelude::PreciseDecimal, scrypto::prelude::ParsePreciseDecimalError } +impl_parse_error! { scrypto::prelude::NonFungibleGlobalId, scrypto::prelude::ParseNonFungibleGlobalIdError } +impl_parse_error! { scrypto::prelude::NonFungibleLocalId, scrypto::prelude::ParseNonFungibleLocalIdError } +impl_parse_error! { scrypto::prelude::Hash, scrypto::prelude::ParseHashError } +impl_parse_error! { u128, std::num::ParseIntError } // TODO: can we continue making the u128 assumption? +impl_parse_error! { scrypto::prelude::ResourceAddress, scrypto::prelude::ParseResourceAddressError } +impl_parse_error! { scrypto::prelude::ComponentAddress, scrypto::prelude::ParseComponentAddressError } +impl_parse_error! { scrypto::prelude::PackageAddress, scrypto::prelude::ParsePackageAddressError } +impl_parse_error! { scrypto::prelude::GlobalAddress, scrypto::prelude::ParseGlobalAddressError } +impl_parse_error! { scrypto::prelude::InternalAddress, scrypto::prelude::ParseInternalAddressError } + +impl_dbg_str_from! { NativeContentValidationError, NonFungibleContentValidationError } +impl_dbg_str_from! { CoreDerivationError, DerivationError } +impl_dbg_str_from! { NativeCompileError, CompileError } +impl_dbg_str_from! { NativeDecompileError, DecompileError } +impl_dbg_str_from! { NativePrepareError, PrepareError } +impl_dbg_str_from! { NativeEncodeError, EncodeError } +impl_dbg_str_from! { NativeDecodeError, DecodeError } +impl_dbg_str_from! { NativeTransactionValidationError, TransactionValidationFailed } +impl_dbg_str_from! { CoreInstructionValidationError, TransactionValidationFailed } +impl_dbg_str_from! { CoreExecutionExecutionModuleError, ExecutionModuleError } +impl_dbg_str_from! { CoreManifestSborError, ManifestSborError } +impl_dbg_str_from! { CoreScryptoSborError, ScryptoSborError } diff --git a/radix-engine-toolkit-uniffi/src/internal_prelude.rs b/radix-engine-toolkit-uniffi/src/internal_prelude.rs new file mode 100644 index 00000000..c8b60f75 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/internal_prelude.rs @@ -0,0 +1,333 @@ +// 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. + +//! This is an internal prelude module meant to only be public within this crate which re-exports +//! types and functions from the core toolkit and Scrypto crates with a prefix. This is done to +//! distinguish between the core toolkit types, scrypto types, and types defined in this crate. +//! We choose the types in this crate to have short un-prefixed names since those are the names that +//! the types will be generated with when using UniFFI + +#[rustfmt::skip] +mod core { + /* Modules */ + pub use radix_engine_toolkit_core::functions::information::{ + information as core_information, + BuildInformation as CoreBuildInformation, + DependencyInformation as CoreDependencyInformation, + }; + pub use radix_engine_toolkit_core::functions::derive::{ + virtual_account_address_from_public_key as core_virtual_account_address_from_public_key, + virtual_identity_address_from_public_key as core_virtual_identity_address_from_public_key, + virtual_signature_non_fungible_global_id_from_public_key as core_virtual_signature_non_fungible_global_id_from_public_key, + virtual_account_address_from_olympia_account_address as core_virtual_account_address_from_olympia_account_address, + resource_address_from_olympia_resource_address as core_resource_address_from_olympia_resource_address, + public_key_from_olympia_account_address as core_public_key_from_olympia_account_address, + olympia_account_address_from_public_key as core_olympia_account_address_from_public_key, + node_address_from_public_key as core_node_address_from_public_key, + DerivationError as CoreDerivationError, + OlympiaNetwork as CoreOlympiaNetwork, + }; + pub use radix_engine_toolkit_core::functions::instructions::{ + hash as core_instructions_hash, + compile as core_instructions_compile, + decompile as core_instructions_decompile, + statically_validate as core_instructions_statically_validate, + extract_addresses as core_instructions_extract_addresses, + identities_requiring_auth as core_instructions_identities_requiring_auth, + accounts_requiring_auth as core_instructions_accounts_requiring_auth, + accounts_withdrawn_from as core_instructions_accounts_withdrawn_from, + accounts_deposited_into as core_instructions_accounts_deposited_into, + InstructionValidationError as CoreInstructionValidationError, + }; + pub use radix_engine_toolkit_core::functions::manifest::{ + hash as core_manifest_hash, + compile as core_manifest_compile, + decompile as core_manifest_decompile, + statically_validate as core_manifest_statically_validate, + }; + pub use radix_engine_toolkit_core::functions::intent::{ + hash as core_intent_hash, + compile as core_intent_compile, + decompile as core_intent_decompile, + statically_validate as core_intent_statically_validate, + }; + pub use radix_engine_toolkit_core::functions::signed_intent::{ + hash as core_signed_intent_hash, + compile as core_signed_intent_compile, + decompile as core_signed_intent_decompile, + statically_validate as core_signed_intent_statically_validate, + }; + pub use radix_engine_toolkit_core::functions::notarized_transaction::{ + hash as core_notarized_transaction_hash, + compile as core_notarized_transaction_compile, + decompile as core_notarized_transaction_decompile, + statically_validate as core_notarized_transaction_statically_validate, + }; + pub use radix_engine_toolkit_core::functions::execution::{ + analyze as core_execution_analyze, + ExecutionAnalysis as CoreExecutionExecutionAnalysis, + FeeSummary as CoreExecutionFeeSummary, + FeeLocks as CoreExecutionFeeLocks, + SimpleTransferTransactionType as CoreExecutionSimpleTransferTransactionType, + TransferTransactionType as CoreExecutionTransferTransactionType, + GeneralTransactionType as CoreExecutionGeneralTransactionType, + TransactionType as CoreExecutionTransactionType, + ExecutionModuleError as CoreExecutionExecutionModuleError, + }; + pub use radix_engine_toolkit_core::functions::manifest_sbor::{ + ManifestSborError as CoreManifestSborError, + ManifestSborStringRepresentation as CoreManifestSborStringRepresentation, + decode_to_string_representation as core_manifest_decode_to_string_representation, + }; + pub use radix_engine_toolkit_core::functions::scrypto_sbor::{ + ScryptoSborError as CoreScryptoSborError, + decode_to_string_representation as core_scrypto_decode_to_string_representation, + }; + + /* Visitors */ + pub use radix_engine_toolkit_core::instruction_visitor::visitors::transaction_type::transfer_visitor::{ + Resources as CoreResources, + }; + pub use radix_engine_toolkit_core::instruction_visitor::visitors::transaction_type::general_transaction_visitor::{ + Source as CoreSource, + }; + + /* Utils */ + pub use radix_engine_toolkit_core::utils::{ + manifest_from_intent as core_manifest_from_intent, + network_definition_from_network_id as core_network_definition_from_network_id, + network_id_from_hrp as core_network_id_from_hrp, + network_id_from_address_string as core_network_id_from_address_string, + to_manifest_type as core_to_manifest_type, + validate_manifest_value_against_schema as core_validate_manifest_value_against_schema, + is_account as core_is_account, + is_identity as core_is_identity, + metadata_of_newly_created_entities as core_metadata_of_newly_created_entities, + data_of_newly_minted_non_fungibles as core_data_of_newly_minted_non_fungibles, + }; +} + +#[rustfmt::skip] +mod native { + pub use transaction::prelude::{ + /* Cryptography */ + Ed25519PrivateKey as NativeEd25519PrivateKey, + Secp256k1PrivateKey as NativeSecp256k1PrivateKey, + + PublicKey as NativePublicKey, + Ed25519PublicKey as NativeEd25519PublicKey, + Secp256k1PublicKey as NativeSecp256k1PublicKey, + + PublicKeyHash as NativePublicKeyHash, + HasPublicKeyHash as NativeHasPublicKeyHash, + Ed25519PublicKeyHash as NativeEd25519PublicKeyHash, + Secp256k1PublicKeyHash as NativeSecp256k1PublicKeyHash, + + SignatureV1 as NativeSignature, + Ed25519Signature as NativeEd25519Signature, + Secp256k1Signature as NativeSecp256k1Signature, + + SignatureWithPublicKeyV1 as NativeSignatureWithPublicKey, + }; + pub use transaction::manifest::{ + compile as native_compile, + decompile as native_decompile, + + IsBlobProvider as NativeIsBlobProvider, + BlobProvider as NativeBlobProvider, + MockBlobProvider as NativeMockBlobProvider, + + CompileError as NativeCompileError, + DecompileError as NativeDecompileError, + }; + + pub use scrypto::prelude::{ + NodeId as NativeNodeId, + EntityType as NativeEntityType, + + GlobalAddress as NativeGlobalAddress, + InternalAddress as NativeInternalAddress, + ComponentAddress as NativeComponentAddress, + ResourceAddress as NativeResourceAddress, + PackageAddress as NativePackageAddress, + + NonFungibleLocalId as NativeNonFungibleLocalId, + NonFungibleGlobalId as NativeNonFungibleGlobalId, + + ParseDecimalError as NativeParseDecimalError, + ParsePreciseDecimalError as NativeParsePreciseDecimalError, + ParseNonFungibleLocalIdError as NativeParseNonFungibleLocalIdError, + ParseNonFungibleGlobalIdError as NativeParseNonFungibleGlobalIdError, + ParseHashError as NativeParseHashError, + ParseResourceAddressError as NativeParseResourceAddressError, + ParseComponentAddressError as NativeParseComponentAddressError, + ParsePackageAddressError as NativeParsePackageAddressError, + ParseGlobalAddressError as NativeParseGlobalAddressError, + + Hash as NativeHash, + hash as native_hash, + + Decimal as NativeDecimal, + PreciseDecimal as NativePreciseDecimal, + RoundingMode as NativeRoundingMode, + + XRD as NATIVE_XRD, + SECP256K1_SIGNATURE_VIRTUAL_BADGE as NATIVE_SECP256K1_SIGNATURE_VIRTUAL_BADGE, + ED25519_SIGNATURE_VIRTUAL_BADGE as NATIVE_ED25519_SIGNATURE_VIRTUAL_BADGE, + PACKAGE_OF_DIRECT_CALLER_VIRTUAL_BADGE as NATIVE_PACKAGE_OF_DIRECT_CALLER_VIRTUAL_BADGE, + GLOBAL_CALLER_VIRTUAL_BADGE as NATIVE_GLOBAL_CALLER_VIRTUAL_BADGE, + SYSTEM_TRANSACTION_BADGE as NATIVE_SYSTEM_TRANSACTION_BADGE, + PACKAGE_OWNER_BADGE as NATIVE_PACKAGE_OWNER_BADGE, + VALIDATOR_OWNER_BADGE as NATIVE_VALIDATOR_OWNER_BADGE, + ACCOUNT_OWNER_BADGE as NATIVE_ACCOUNT_OWNER_BADGE, + IDENTITY_OWNER_BADGE as NATIVE_IDENTITY_OWNER_BADGE, + PACKAGE_PACKAGE as NATIVE_PACKAGE_PACKAGE, + RESOURCE_PACKAGE as NATIVE_RESOURCE_PACKAGE, + ACCOUNT_PACKAGE as NATIVE_ACCOUNT_PACKAGE, + IDENTITY_PACKAGE as NATIVE_IDENTITY_PACKAGE, + CONSENSUS_MANAGER_PACKAGE as NATIVE_CONSENSUS_MANAGER_PACKAGE, + ACCESS_CONTROLLER_PACKAGE as NATIVE_ACCESS_CONTROLLER_PACKAGE, + POOL_PACKAGE as NATIVE_POOL_PACKAGE, + TRANSACTION_PROCESSOR_PACKAGE as NATIVE_TRANSACTION_PROCESSOR_PACKAGE, + METADATA_MODULE_PACKAGE as NATIVE_METADATA_MODULE_PACKAGE, + ROYALTY_MODULE_PACKAGE as NATIVE_ROYALTY_MODULE_PACKAGE, + ACCESS_RULES_MODULE_PACKAGE as NATIVE_ACCESS_RULES_MODULE_PACKAGE, + GENESIS_HELPER_PACKAGE as NATIVE_GENESIS_HELPER_PACKAGE, + GENESIS_HELPER_BLUEPRINT as NATIVE_GENESIS_HELPER_BLUEPRINT, + FAUCET_PACKAGE as NATIVE_FAUCET_PACKAGE, + FAUCET_BLUEPRINT as NATIVE_FAUCET_BLUEPRINT, + TRANSACTION_TRACKER_PACKAGE as NATIVE_TRANSACTION_TRACKER_PACKAGE, + TRANSACTION_TRACKER_BLUEPRINT as NATIVE_TRANSACTION_TRACKER_BLUEPRINT, + CONSENSUS_MANAGER as NATIVE_CONSENSUS_MANAGER, + GENESIS_HELPER as NATIVE_GENESIS_HELPER, + FAUCET as NATIVE_FAUCET, + TRANSACTION_TRACKER as NATIVE_TRANSACTION_TRACKER, + + ManifestValue as NativeManifestValue, + ManifestCustomValue as NativeManifestCustomValue, + ManifestValueKind as NativeManifestValueKind, + ManifestCustomValueKind as NativeManifestCustomValueKind, + + ScryptoValue as NativeScryptoValue, + ScryptoCustomValue as NativeScryptoCustomValue, + ScryptoValueKind as NativeScryptoValueKind, + ScryptoCustomValueKind as NativeScryptoCustomValueKind, + + ManifestAddress as NativeManifestAddress, + ManifestBucket as NativeManifestBucket, + ManifestProof as NativeManifestProof, + ManifestExpression as NativeManifestExpression, + ManifestBlobRef as NativeManifestBlobRef, + ManifestAddressReservation as NativeManifestAddressReservation, + + scrypto_encode as native_scrypto_encode, + scrypto_decode as native_scrypto_decode, + manifest_encode as native_manifest_encode, + manifest_decode as native_manifest_decode, + }; + pub use scrypto::address::{ + AddressBech32Decoder as NativeAddressBech32Decoder, + AddressBech32Encoder as NativeAddressBech32Encoder, + }; + pub use transaction::prelude::{ + InstructionV1 as NativeInstruction, + InstructionsV1 as NativeInstructions, + DynamicGlobalAddress as NativeDynamicGlobalAddress, + DynamicPackageAddress as NativeDynamicPackageAddress, + + TransactionHeaderV1 as NativeTransactionHeader, + TransactionManifestV1 as NativeTransactionManifest, + IntentV1 as NativeIntent, + SignedIntentV1 as NativeSignedIntent, + NotarizedTransactionV1 as NativeNotarizedTransaction, + BlobV1 as NativeBlob, + BlobsV1 as NativeBlobs, + + Epoch as NativeEpoch, + + AesGcmPayload as NativeAesGcmPayload, + AesWrapped128BitKey as NativeAesWrapped128BitKey, + CurveType as NativeCurveType, + DecryptorsByCurve as NativeDecryptorsByCurve, + EncryptedMessageV1 as NativeEncryptedMessage, + MessageContentsV1 as NativeMessageContents, + MessageV1 as NativeMessage, + PlaintextMessageV1 as NativePlaintextMessage, + PublicKeyFingerprint as NativePublicKeyFingerprint, + + TransactionPayload as NativeTransactionPayload, + PrepareError as NativePrepareError, + HasIntentHash as NativeHasIntentHash, + HasSignedIntentHash as NativeHasSignedIntentHash, + HasNotarizedTransactionHash as NativeHasNotarizedTransactionHash, + + IntentSignatureV1 as NativeIntentSignature, + IntentSignaturesV1 as NativeIntentSignatures, + NotarySignatureV1 as NativeNotarySignature, + + IntentHash as NativeIntentHash, + SignedIntentHash as NativeSignedIntentHash, + NotarizedTransactionHash as NativeNotarizedTransactionHash, + + IsHash as NativeIsHash, + HashHasHrp as NativeHashHasHrp, + TransactionHashBech32Encoder as NativeTransactionHashBech32Encoder, + TransactionHashBech32Decoder as NativeTransactionHashBech32Decoder, + }; + pub use transaction::validation::{ + ValidationConfig as NativeValidationConfig, + MessageValidationConfig as NativeMessageValidationConfig, + }; + pub use transaction::errors::{ + TransactionValidationError as NativeTransactionValidationError, + }; + pub use radix_engine_common::data::scrypto::model::{ + ContentValidationError as NativeContentValidationError, + }; + pub use radix_engine_common::data::manifest::converter::{ + from_decimal as native_from_decimal, + from_precise_decimal as native_from_precise_decimal, + from_non_fungible_local_id as native_from_non_fungible_local_id, + to_decimal as native_to_decimal, + to_precise_decimal as native_to_precise_decimal, + to_non_fungible_local_id as native_to_non_fungible_local_id, + }; + pub use scrypto::api::node_modules::metadata::{ + MetadataValue as NativeMetadataValue + }; + pub use sbor::prelude::{ + EncodeError as NativeEncodeError, + DecodeError as NativeDecodeError, + }; + pub use sbor::schema::{ + LocalTypeIndex as NativeLocalTypeIndex + }; + pub use sbor::representations::{ + SerializationMode as NativeSerializationMode + }; + pub use radix_engine_common::prelude::{ + ScryptoSchema as NativeScryptoSchema, + SCRYPTO_SBOR_V1_PAYLOAD_PREFIX as NATIVE_SCRYPTO_SBOR_V1_PAYLOAD_PREFIX, + MANIFEST_SBOR_V1_PAYLOAD_PREFIX as NATIVE_MANIFEST_SBOR_V1_PAYLOAD_PREFIX + }; + pub use radix_engine::system::system_modules::execution_trace::{ + ResourceSpecifier as NativeResourceSpecifier, + }; +} + +pub use self::core::*; +pub use self::native::*; diff --git a/radix-engine-toolkit-uniffi/src/lib.rs b/radix-engine-toolkit-uniffi/src/lib.rs new file mode 100644 index 00000000..4b5d48b3 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/lib.rs @@ -0,0 +1,95 @@ +// 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 build; +pub mod common; +pub mod cryptography; +pub mod derive; +pub mod error; +pub mod manifest; +pub mod sbor; +pub mod transaction; +pub mod utils; + +pub(crate) mod internal_prelude; + +// Everything is imported at the root of the crate. This is to support some of the needs of the +// UniFFI toolkit. +pub mod prelude { + /* Common */ + pub use crate::common::address::*; + pub use crate::common::decimal::*; + pub use crate::common::entity_type::*; + pub use crate::common::metadata::*; + pub use crate::common::non_fungible::*; + pub use crate::common::olympia::*; + + /* Errors */ + pub use crate::error::*; + + /* Cryptography */ + pub use crate::cryptography::hash::*; + pub use crate::cryptography::public_key::*; + pub use crate::cryptography::public_key_hash::*; + pub use crate::cryptography::signature::*; + pub use crate::cryptography::signature_with_public_key::*; + + /* Manifest */ + pub use crate::manifest::address::*; + pub use crate::manifest::address_reservation::*; + pub use crate::manifest::blob::*; + pub use crate::manifest::bucket::*; + pub use crate::manifest::expression::*; + pub use crate::manifest::proof::*; + pub use crate::manifest::value::*; + + /* Transaction */ + pub use crate::transaction::hash::*; + pub use crate::transaction::header::*; + pub use crate::transaction::instruction::*; + pub use crate::transaction::instructions::*; + pub use crate::transaction::intent::*; + pub use crate::transaction::manifest::*; + pub use crate::transaction::message::*; + pub use crate::transaction::notarized_transaction::*; + pub use crate::transaction::signed_intent::*; + pub use crate::transaction::validation::*; + + /* SBOR */ + pub use crate::sbor::functions::*; + + /* Build */ + pub use crate::build::functions::*; + + /* Utils */ + pub use crate::utils::functions::*; + + /* Derive */ + pub use crate::derive::functions::*; + + /* Internal Prelude */ + pub(crate) use crate::internal_prelude::*; + + /* Often needed */ + pub(crate) use std::collections::{BTreeMap, HashMap}; + pub(crate) use std::sync::Arc; + pub(crate) use thiserror::Error as ThisError; + pub(crate) use uniffi::{Enum, Error, Object, Record}; +} +pub use prelude::*; + +uniffi::include_scaffolding!("radix_engine_toolkit_uniffi"); diff --git a/radix-engine-toolkit-uniffi/src/manifest/address.rs b/radix-engine-toolkit-uniffi/src/manifest/address.rs new file mode 100644 index 00000000..ecf7da99 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/manifest/address.rs @@ -0,0 +1,94 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Enum)] +pub enum ManifestAddress { + Named { value: u32 }, + Static { value: Arc
}, +} + +impl From for NativeManifestAddress { + fn from(value: ManifestAddress) -> Self { + match value { + ManifestAddress::Named { value } => Self::Named(value), + ManifestAddress::Static { value } => Self::Static(value.0), + } + } +} + +impl ManifestAddress { + pub fn new(native: &NativeManifestAddress, network_id: u8) -> Self { + match native { + NativeManifestAddress::Named(value) => Self::Named { value: *value }, + NativeManifestAddress::Static(value) => Self::Static { + value: Arc::new(Address(*value, network_id)), + }, + } + } + + pub fn from_dynamic_global_address( + native: &NativeDynamicGlobalAddress, + network_id: u8, + ) -> Self { + match native { + NativeDynamicGlobalAddress::Named(value) => Self::Named { value: *value }, + NativeDynamicGlobalAddress::Static(value) => Self::Static { + value: Arc::new(Address(value.into_node_id(), network_id)), + }, + } + } + + pub fn from_dynamic_package_address( + native: &NativeDynamicPackageAddress, + network_id: u8, + ) -> Self { + match native { + NativeDynamicPackageAddress::Named(value) => Self::Named { value: *value }, + NativeDynamicPackageAddress::Static(value) => Self::Static { + value: Arc::new(Address(value.into_node_id(), network_id)), + }, + } + } +} + +impl TryFrom for NativeDynamicPackageAddress { + type Error = RadixEngineToolkitError; + + fn try_from(value: ManifestAddress) -> std::result::Result { + match value { + ManifestAddress::Named { value } => Ok(Self::Named(value)), + ManifestAddress::Static { value } => { + value.0 .0.try_into().map(Self::Static).map_err(Into::into) + } + } + } +} + +impl TryFrom for NativeDynamicGlobalAddress { + type Error = RadixEngineToolkitError; + + fn try_from(value: ManifestAddress) -> std::result::Result { + match value { + ManifestAddress::Named { value } => Ok(Self::Named(value)), + ManifestAddress::Static { value } => { + value.0 .0.try_into().map(Self::Static).map_err(Into::into) + } + } + } +} diff --git a/radix-engine-toolkit/src/traits.rs b/radix-engine-toolkit-uniffi/src/manifest/address_reservation.rs similarity index 63% rename from radix-engine-toolkit/src/traits.rs rename to radix-engine-toolkit-uniffi/src/manifest/address_reservation.rs index e2a0f613..78bff8f6 100644 --- a/radix-engine-toolkit/src/traits.rs +++ b/radix-engine-toolkit-uniffi/src/manifest/address_reservation.rs @@ -15,20 +15,21 @@ // specific language governing permissions and limitations // under the License. -use crate::error::Result; -use crate::model::transaction::InstructionKind; -use scrypto::prelude::{hash, Hash}; +use crate::prelude::*; -/// A trait that defines the common interface of all compile-able intents -pub trait CompilableIntent { - fn compile(&self) -> Result>; +#[derive(Debug, Clone, Record, Copy)] +pub struct ManifestAddressReservation { + pub value: u32, +} - fn decompile(data: &T, instructions_kind: InstructionKind) -> Result - where - Self: Sized, - T: AsRef<[u8]>; +impl From for ManifestAddressReservation { + fn from(value: NativeManifestAddressReservation) -> Self { + Self { value: value.0 } + } +} - fn hash(&self) -> Result { - self.compile().map(hash) +impl From for NativeManifestAddressReservation { + fn from(value: ManifestAddressReservation) -> Self { + Self(value.value) } } diff --git a/cli-json-interface/src/main.rs b/radix-engine-toolkit-uniffi/src/manifest/blob.rs similarity index 64% rename from cli-json-interface/src/main.rs rename to radix-engine-toolkit-uniffi/src/manifest/blob.rs index 2a0d120e..acd55c2b 100644 --- a/cli-json-interface/src/main.rs +++ b/radix-engine-toolkit-uniffi/src/manifest/blob.rs @@ -5,9 +5,9 @@ // 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 @@ -15,21 +15,23 @@ // specific language governing permissions and limitations // under the License. -mod cli; -mod error; -mod subcommands; -mod utils; +use crate::prelude::*; -use clap::Parser; +#[derive(Clone, Debug, Record)] +pub struct ManifestBlobRef { + pub value: Arc, +} -pub fn main() -> crate::error::Result<()> { - let cli = cli::Cli::parse(); - let mut out = std::io::stdout(); +impl From for ManifestBlobRef { + fn from(value: NativeManifestBlobRef) -> Self { + Self { + value: Arc::new(NativeHash(value.0).into()), + } + } +} - 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), +impl From for NativeManifestBlobRef { + fn from(value: ManifestBlobRef) -> Self { + Self(value.value.0 .0) } } diff --git a/radix-engine-toolkit-uniffi/src/manifest/bucket.rs b/radix-engine-toolkit-uniffi/src/manifest/bucket.rs new file mode 100644 index 00000000..daf611fe --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/manifest/bucket.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 crate::prelude::*; + +#[derive(Debug, Clone, Record, Copy)] +pub struct ManifestBucket { + pub value: u32, +} + +impl From for ManifestBucket { + fn from(value: NativeManifestBucket) -> Self { + Self { value: value.0 } + } +} + +impl From for NativeManifestBucket { + fn from(value: ManifestBucket) -> Self { + Self(value.value) + } +} diff --git a/radix-engine-toolkit/src/model/runtime/expression.rs b/radix-engine-toolkit-uniffi/src/manifest/expression.rs similarity index 70% rename from radix-engine-toolkit/src/model/runtime/expression.rs rename to radix-engine-toolkit-uniffi/src/manifest/expression.rs index 682e5573..ee0c242c 100644 --- a/radix-engine-toolkit/src/model/runtime/expression.rs +++ b/radix-engine-toolkit-uniffi/src/manifest/expression.rs @@ -5,9 +5,9 @@ // 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 @@ -15,31 +15,28 @@ // specific language governing permissions and limitations // under the License. -use scrypto::prelude::ManifestExpression; -use toolkit_derive::serializable; +use crate::prelude::*; -#[serializable] -#[serde(rename_all = "SCREAMING_SNAKE_CASE")] -/// Represents a transaction manifest expression. -pub enum Expression { +#[derive(Clone, Debug, Enum, Copy)] +pub enum ManifestExpression { EntireWorktop, EntireAuthZone, } -impl From for Expression { - fn from(value: ManifestExpression) -> Self { +impl From for ManifestExpression { + fn from(value: NativeManifestExpression) -> Self { match value { - ManifestExpression::EntireAuthZone => Self::EntireAuthZone, - ManifestExpression::EntireWorktop => Self::EntireWorktop, + NativeManifestExpression::EntireAuthZone => Self::EntireAuthZone, + NativeManifestExpression::EntireWorktop => Self::EntireWorktop, } } } -impl From for ManifestExpression { - fn from(value: Expression) -> Self { +impl From for NativeManifestExpression { + fn from(value: ManifestExpression) -> Self { match value { - Expression::EntireAuthZone => Self::EntireAuthZone, - Expression::EntireWorktop => Self::EntireWorktop, + ManifestExpression::EntireAuthZone => Self::EntireAuthZone, + ManifestExpression::EntireWorktop => Self::EntireWorktop, } } } diff --git a/radix-engine-toolkit/src/model/runtime/mod.rs b/radix-engine-toolkit-uniffi/src/manifest/mod.rs similarity index 90% rename from radix-engine-toolkit/src/model/runtime/mod.rs rename to radix-engine-toolkit-uniffi/src/manifest/mod.rs index 00167204..26f65875 100644 --- a/radix-engine-toolkit/src/model/runtime/mod.rs +++ b/radix-engine-toolkit-uniffi/src/manifest/mod.rs @@ -15,8 +15,10 @@ // specific language governing permissions and limitations // under the License. +pub mod address; +pub mod address_reservation; pub mod blob; +pub mod bucket; pub mod expression; - -pub use blob::*; -pub use expression::*; +pub mod proof; +pub mod value; diff --git a/radix-engine-toolkit-uniffi/src/manifest/proof.rs b/radix-engine-toolkit-uniffi/src/manifest/proof.rs new file mode 100644 index 00000000..940a5a73 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/manifest/proof.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 crate::prelude::*; + +#[derive(Debug, Clone, Record, Copy)] +pub struct ManifestProof { + pub value: u32, +} + +impl From for ManifestProof { + fn from(value: NativeManifestProof) -> Self { + Self { value: value.0 } + } +} + +impl From for NativeManifestProof { + fn from(value: ManifestProof) -> Self { + Self(value.value) + } +} diff --git a/radix-engine-toolkit-uniffi/src/manifest/value.rs b/radix-engine-toolkit-uniffi/src/manifest/value.rs new file mode 100644 index 00000000..492d091f --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/manifest/value.rs @@ -0,0 +1,447 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Enum)] +pub enum ManifestValue { + /* Primitive */ + BoolValue { + value: bool, + }, + I8Value { + value: i8, + }, + I16Value { + value: i16, + }, + I32Value { + value: i32, + }, + I64Value { + value: i64, + }, + I128Value { + value: String, + }, + U8Value { + value: u8, + }, + U16Value { + value: u16, + }, + U32Value { + value: u32, + }, + U64Value { + value: u64, + }, + U128Value { + value: String, + }, + StringValue { + value: String, + }, + EnumValue { + discriminator: u8, + fields: Vec, + }, + ArrayValue { + element_value_kind: ManifestValueKind, + elements: Vec, + }, + TupleValue { + fields: Vec, + }, + MapValue { + key_value_kind: ManifestValueKind, + value_value_kind: ManifestValueKind, + entries: Vec, + }, + /* Custom */ + AddressValue { + value: ManifestAddress, + }, + BucketValue { + value: ManifestBucket, + }, + ProofValue { + value: ManifestProof, + }, + ExpressionValue { + value: ManifestExpression, + }, + BlobValue { + value: ManifestBlobRef, + }, + DecimalValue { + value: Arc, + }, + PreciseDecimalValue { + value: Arc, + }, + NonFungibleLocalIdValue { + value: NonFungibleLocalId, + }, + AddressReservationValue { + value: ManifestAddressReservation, + }, +} + +#[derive(Clone, Debug, Record)] +pub struct MapEntry { + pub key: ManifestValue, + pub value: ManifestValue, +} + +#[derive(Clone, Debug, Enum, Copy)] +pub enum ManifestValueKind { + /* Primitive */ + BoolValue, + I8Value, + I16Value, + I32Value, + I64Value, + I128Value, + U8Value, + U16Value, + U32Value, + U64Value, + U128Value, + StringValue, + EnumValue, + ArrayValue, + TupleValue, + MapValue, + /* Custom */ + AddressValue, + BucketValue, + ProofValue, + ExpressionValue, + BlobValue, + DecimalValue, + PreciseDecimalValue, + NonFungibleLocalIdValue, + AddressReservationValue, +} + +impl From for NativeManifestValueKind { + fn from(value: ManifestValueKind) -> Self { + match value { + /* Primitive */ + ManifestValueKind::BoolValue => Self::Bool, + ManifestValueKind::I8Value => Self::I8, + ManifestValueKind::I16Value => Self::I16, + ManifestValueKind::I32Value => Self::I32, + ManifestValueKind::I64Value => Self::I64, + ManifestValueKind::I128Value => Self::I128, + ManifestValueKind::U8Value => Self::U8, + ManifestValueKind::U16Value => Self::U16, + ManifestValueKind::U32Value => Self::U32, + ManifestValueKind::U64Value => Self::U64, + ManifestValueKind::U128Value => Self::U128, + ManifestValueKind::StringValue => Self::String, + ManifestValueKind::EnumValue => Self::Enum, + ManifestValueKind::ArrayValue => Self::Array, + ManifestValueKind::TupleValue => Self::Tuple, + ManifestValueKind::MapValue => Self::Map, + /* Custom */ + ManifestValueKind::AddressValue => Self::Custom(NativeManifestCustomValueKind::Address), + ManifestValueKind::BucketValue => Self::Custom(NativeManifestCustomValueKind::Bucket), + ManifestValueKind::ProofValue => Self::Custom(NativeManifestCustomValueKind::Proof), + ManifestValueKind::ExpressionValue => { + Self::Custom(NativeManifestCustomValueKind::Expression) + } + ManifestValueKind::BlobValue => Self::Custom(NativeManifestCustomValueKind::Blob), + ManifestValueKind::DecimalValue => Self::Custom(NativeManifestCustomValueKind::Decimal), + ManifestValueKind::PreciseDecimalValue => { + Self::Custom(NativeManifestCustomValueKind::PreciseDecimal) + } + ManifestValueKind::NonFungibleLocalIdValue => { + Self::Custom(NativeManifestCustomValueKind::NonFungibleLocalId) + } + ManifestValueKind::AddressReservationValue => { + Self::Custom(NativeManifestCustomValueKind::AddressReservation) + } + } + } +} + +impl From for ManifestValueKind { + fn from(value: NativeManifestValueKind) -> Self { + match value { + /* Primitive */ + NativeManifestValueKind::Bool => Self::BoolValue, + NativeManifestValueKind::I8 => Self::I8Value, + NativeManifestValueKind::I16 => Self::I16Value, + NativeManifestValueKind::I32 => Self::I32Value, + NativeManifestValueKind::I64 => Self::I64Value, + NativeManifestValueKind::I128 => Self::I128Value, + NativeManifestValueKind::U8 => Self::U8Value, + NativeManifestValueKind::U16 => Self::U16Value, + NativeManifestValueKind::U32 => Self::U32Value, + NativeManifestValueKind::U64 => Self::U64Value, + NativeManifestValueKind::U128 => Self::U128Value, + NativeManifestValueKind::String => Self::StringValue, + NativeManifestValueKind::Enum => Self::EnumValue, + NativeManifestValueKind::Array => Self::ArrayValue, + NativeManifestValueKind::Tuple => Self::TupleValue, + NativeManifestValueKind::Map => Self::MapValue, + /* Custom */ + NativeManifestValueKind::Custom(NativeManifestCustomValueKind::Address) => { + Self::AddressValue + } + NativeManifestValueKind::Custom(NativeManifestCustomValueKind::Bucket) => { + Self::BucketValue + } + NativeManifestValueKind::Custom(NativeManifestCustomValueKind::Proof) => { + Self::ProofValue + } + NativeManifestValueKind::Custom(NativeManifestCustomValueKind::Expression) => { + Self::ExpressionValue + } + NativeManifestValueKind::Custom(NativeManifestCustomValueKind::Blob) => Self::BlobValue, + NativeManifestValueKind::Custom(NativeManifestCustomValueKind::Decimal) => { + Self::DecimalValue + } + NativeManifestValueKind::Custom(NativeManifestCustomValueKind::PreciseDecimal) => { + Self::PreciseDecimalValue + } + NativeManifestValueKind::Custom(NativeManifestCustomValueKind::NonFungibleLocalId) => { + Self::NonFungibleLocalIdValue + } + NativeManifestValueKind::Custom(NativeManifestCustomValueKind::AddressReservation) => { + Self::AddressReservationValue + } + } + } +} + +impl ManifestValue { + pub fn to_native(&self) -> Result { + let value = match self { + Self::BoolValue { value } => NativeManifestValue::Bool { value: *value }, + + Self::U8Value { value } => NativeManifestValue::U8 { value: *value }, + Self::U16Value { value } => NativeManifestValue::U16 { value: *value }, + Self::U32Value { value } => NativeManifestValue::U32 { value: *value }, + Self::U64Value { value } => NativeManifestValue::U64 { value: *value }, + Self::U128Value { value } => NativeManifestValue::U128 { + value: value.parse()?, + }, + + Self::I8Value { value } => NativeManifestValue::I8 { value: *value }, + Self::I16Value { value } => NativeManifestValue::I16 { value: *value }, + Self::I32Value { value } => NativeManifestValue::I32 { value: *value }, + Self::I64Value { value } => NativeManifestValue::I64 { value: *value }, + Self::I128Value { value } => NativeManifestValue::I128 { + value: value.parse()?, + }, + + Self::StringValue { value } => NativeManifestValue::String { + value: value.clone(), + }, + Self::EnumValue { + discriminator, + fields, + } => NativeManifestValue::Enum { + discriminator: *discriminator, + fields: fields + .iter() + .map(|item| item.to_native()) + .collect::>()?, + }, + Self::ArrayValue { + element_value_kind, + elements, + } => NativeManifestValue::Array { + element_value_kind: (*element_value_kind).into(), + elements: elements + .iter() + .map(|item| item.to_native()) + .collect::>()?, + }, + Self::TupleValue { fields } => NativeManifestValue::Tuple { + fields: fields + .iter() + .map(|item| item.to_native()) + .collect::>()?, + }, + Self::MapValue { + key_value_kind, + value_value_kind, + entries, + } => NativeManifestValue::Map { + key_value_kind: (*key_value_kind).into(), + value_value_kind: (*value_value_kind).into(), + entries: entries + .iter() + .map(|MapEntry { key, value }| { + key.to_native() + .and_then(|key| value.to_native().map(|value| (key, value))) + }) + .collect::>()?, + }, + Self::AddressValue { value } => NativeManifestValue::Custom { + value: NativeManifestCustomValue::Address(value.clone().into()), + }, + Self::BucketValue { value } => NativeManifestValue::Custom { + value: NativeManifestCustomValue::Bucket((*value).into()), + }, + Self::ProofValue { value } => NativeManifestValue::Custom { + value: NativeManifestCustomValue::Proof((*value).into()), + }, + Self::AddressReservationValue { value } => NativeManifestValue::Custom { + value: NativeManifestCustomValue::AddressReservation((*value).into()), + }, + Self::ExpressionValue { value } => NativeManifestValue::Custom { + value: NativeManifestCustomValue::Expression((*value).into()), + }, + Self::BlobValue { value } => NativeManifestValue::Custom { + value: NativeManifestCustomValue::Blob(value.clone().into()), + }, + Self::DecimalValue { value } => NativeManifestValue::Custom { + value: NativeManifestCustomValue::Decimal(native_from_decimal(&value.0)), + }, + Self::PreciseDecimalValue { value } => NativeManifestValue::Custom { + value: NativeManifestCustomValue::PreciseDecimal(native_from_precise_decimal( + &value.0, + )), + }, + Self::NonFungibleLocalIdValue { value } => NativeManifestValue::Custom { + value: NativeManifestCustomValue::NonFungibleLocalId( + native_from_non_fungible_local_id(value.clone().try_into()?), + ), + }, + }; + Ok(value) + } + + pub fn from_native(native: &NativeManifestValue, network_id: u8) -> Self { + match native { + NativeManifestValue::Bool { value } => Self::BoolValue { value: *value }, + + NativeManifestValue::U8 { value } => Self::U8Value { value: *value }, + NativeManifestValue::U16 { value } => Self::U16Value { value: *value }, + NativeManifestValue::U32 { value } => Self::U32Value { value: *value }, + NativeManifestValue::U64 { value } => Self::U64Value { value: *value }, + NativeManifestValue::U128 { value } => Self::U128Value { + value: value.to_string(), + }, + + NativeManifestValue::I8 { value } => Self::I8Value { value: *value }, + NativeManifestValue::I16 { value } => Self::I16Value { value: *value }, + NativeManifestValue::I32 { value } => Self::I32Value { value: *value }, + NativeManifestValue::I64 { value } => Self::I64Value { value: *value }, + NativeManifestValue::I128 { value } => Self::I128Value { + value: value.to_string(), + }, + + NativeManifestValue::String { value } => Self::StringValue { + value: value.clone(), + }, + NativeManifestValue::Enum { + discriminator, + fields, + } => Self::EnumValue { + discriminator: *discriminator, + fields: fields + .iter() + .map(|value| Self::from_native(value, network_id)) + .collect(), + }, + NativeManifestValue::Array { + element_value_kind, + elements, + } => Self::ArrayValue { + element_value_kind: (*element_value_kind).into(), + elements: elements + .iter() + .map(|value| Self::from_native(value, network_id)) + .collect(), + }, + NativeManifestValue::Tuple { fields } => Self::TupleValue { + fields: fields + .iter() + .map(|value| Self::from_native(value, network_id)) + .collect(), + }, + NativeManifestValue::Map { + key_value_kind, + value_value_kind, + entries, + } => Self::MapValue { + key_value_kind: (*key_value_kind).into(), + value_value_kind: (*value_value_kind).into(), + entries: entries + .iter() + .map(|(key, value)| MapEntry { + key: Self::from_native(key, network_id), + value: Self::from_native(value, network_id), + }) + .collect(), + }, + NativeManifestValue::Custom { + value: NativeManifestCustomValue::Address(value), + } => Self::AddressValue { + value: ManifestAddress::new(value, network_id), + }, + NativeManifestValue::Custom { + value: NativeManifestCustomValue::Bucket(value), + } => Self::BucketValue { + value: ManifestBucket { value: value.0 }, + }, + NativeManifestValue::Custom { + value: NativeManifestCustomValue::Proof(value), + } => Self::ProofValue { + value: ManifestProof { value: value.0 }, + }, + NativeManifestValue::Custom { + value: NativeManifestCustomValue::Expression(value), + } => Self::ExpressionValue { + value: (*value).into(), + }, + NativeManifestValue::Custom { + value: NativeManifestCustomValue::Decimal(value), + } => Self::DecimalValue { + value: Arc::new(Decimal(native_to_decimal(value))), + }, + NativeManifestValue::Custom { + value: NativeManifestCustomValue::PreciseDecimal(value), + } => Self::PreciseDecimalValue { + value: Arc::new(PreciseDecimal(native_to_precise_decimal(value))), + }, + NativeManifestValue::Custom { + value: NativeManifestCustomValue::NonFungibleLocalId(value), + } => Self::NonFungibleLocalIdValue { + value: native_to_non_fungible_local_id(value.clone()).into(), + }, + NativeManifestValue::Custom { + value: NativeManifestCustomValue::AddressReservation(value), + } => Self::AddressReservationValue { + value: ManifestAddressReservation { value: value.0 }, + }, + NativeManifestValue::Custom { + value: NativeManifestCustomValue::Blob(value), + } => Self::BlobValue { + value: ManifestBlobRef { + value: Arc::new(Hash(NativeHash(value.0))), + }, + }, + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl b/radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl new file mode 100644 index 00000000..c5172905 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/radix_engine_toolkit_uniffi.udl @@ -0,0 +1 @@ +namespace radix_engine_toolkit_uniffi {}; diff --git a/radix-engine-toolkit-uniffi/src/sbor/functions.rs b/radix-engine-toolkit-uniffi/src/sbor/functions.rs new file mode 100644 index 00000000..35f68913 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/sbor/functions.rs @@ -0,0 +1,155 @@ +// 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::prelude::*; + +#[uniffi::export] +pub fn sbor_decode_to_string_representation( + bytes: Vec, + representation: SerializationMode, + network_id: u8, + schema: Option, +) -> Result { + match bytes.first().copied() { + Some(NATIVE_SCRYPTO_SBOR_V1_PAYLOAD_PREFIX) => { + scrypto_sbor_decode_to_string_representation(bytes, representation, network_id, schema) + } + Some(NATIVE_MANIFEST_SBOR_V1_PAYLOAD_PREFIX) => { + manifest_sbor_decode_to_string_representation( + bytes, + ManifestSborStringRepresentation::JSON { + value: representation, + }, + network_id, + schema, + ) + } + _ => Err(RadixEngineToolkitError::DecodeError { + error: "Invalid Sbor payload prefix".into(), + }), + } +} + +#[uniffi::export] +pub fn scrypto_sbor_decode_to_string_representation( + bytes: Vec, + representation: SerializationMode, + network_id: u8, + schema: Option, +) -> Result { + let network_definition = core_network_definition_from_network_id(network_id); + let bech32_encoder = NativeAddressBech32Encoder::new(&network_definition); + let string = core_scrypto_decode_to_string_representation( + bytes, + representation.into(), + &bech32_encoder, + if let Some(schema) = schema { + Some(schema.try_into()?) + } else { + None + }, + )?; + Ok(string) +} + +#[uniffi::export] +pub fn manifest_sbor_decode_to_string_representation( + bytes: Vec, + representation: ManifestSborStringRepresentation, + network_id: u8, + schema: Option, +) -> Result { + let network_definition = core_network_definition_from_network_id(network_id); + let bech32_encoder = NativeAddressBech32Encoder::new(&network_definition); + let string = core_manifest_decode_to_string_representation( + bytes, + representation.into(), + &bech32_encoder, + if let Some(schema) = schema { + Some(schema.try_into()?) + } else { + None + }, + )?; + Ok(string) +} + +#[derive(Clone, Debug, Enum)] +pub enum ManifestSborStringRepresentation { + ManifestString, + JSON { value: SerializationMode }, +} + +#[derive(Clone, Debug, Enum)] +pub enum SerializationMode { + Programmatic, + Natural, +} + +#[derive(Clone, Debug, Enum)] +pub enum LocalTypeIndex { + WellKnown { value: u8 }, + SchemaLocalIndex { value: u64 }, +} + +#[derive(Clone, Debug, Record)] +pub struct Schema { + pub local_type_index: LocalTypeIndex, + pub schema: Vec, +} + +impl From for CoreManifestSborStringRepresentation { + fn from(value: ManifestSborStringRepresentation) -> Self { + match value { + ManifestSborStringRepresentation::ManifestString => Self::ManifestString, + ManifestSborStringRepresentation::JSON { value } => Self::JSON(value.into()), + } + } +} + +impl From for NativeSerializationMode { + fn from(value: SerializationMode) -> Self { + match value { + SerializationMode::Natural => Self::Natural, + SerializationMode::Programmatic => Self::Programmatic, + } + } +} + +impl From for NativeLocalTypeIndex { + fn from(value: LocalTypeIndex) -> Self { + match value { + LocalTypeIndex::WellKnown { value } => Self::WellKnown(value), + LocalTypeIndex::SchemaLocalIndex { value } => Self::SchemaLocalIndex(value as usize), + } + } +} + +impl TryFrom for (NativeLocalTypeIndex, NativeScryptoSchema) { + type Error = RadixEngineToolkitError; + + fn try_from( + Schema { + local_type_index, + schema, + }: Schema, + ) -> Result { + let local_type_index = local_type_index.into(); + let schema = native_manifest_decode(&schema)?; + Ok((local_type_index, schema)) + } +} diff --git a/radix-engine-toolkit-uniffi/src/sbor/mod.rs b/radix-engine-toolkit-uniffi/src/sbor/mod.rs new file mode 100644 index 00000000..9d79f07c --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/sbor/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 functions; diff --git a/radix-engine-toolkit-uniffi/src/transaction/hash.rs b/radix-engine-toolkit-uniffi/src/transaction/hash.rs new file mode 100644 index 00000000..b27c854a --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/hash.rs @@ -0,0 +1,50 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Object)] +pub struct TransactionHash(pub(crate) NativeHash, pub(crate) String, pub(crate) u8); + +#[uniffi::export] +impl TransactionHash { + pub fn as_str(&self) -> String { + self.1.to_owned() + } + + pub fn bytes(&self) -> Vec { + self.0.to_vec() + } + + pub fn network_id(&self) -> u8 { + self.2 + } +} + +impl TransactionHash { + pub fn new(hash: &T, network_id: u8) -> Self + where + T: NativeHashHasHrp + NativeIsHash, + { + let network_definition = core_network_definition_from_network_id(network_id); + let bech32_encoder = NativeTransactionHashBech32Encoder::new(&network_definition); + let encoded = bech32_encoder + .encode(hash) + .expect("Bech32m encoding tx hashes cant fail"); + Self(*hash.as_hash(), encoded, network_id) + } +} diff --git a/radix-engine-toolkit-uniffi/src/transaction/header.rs b/radix-engine-toolkit-uniffi/src/transaction/header.rs new file mode 100644 index 00000000..e4e2a5e7 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/header.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::prelude::*; + +#[derive(Clone, Debug, Record)] +pub struct TransactionHeader { + pub network_id: u8, + pub start_epoch_inclusive: u64, + pub end_epoch_exclusive: u64, + pub nonce: u32, + pub notary_public_key: PublicKey, + pub notary_is_signatory: bool, + pub tip_percentage: u16, +} + +impl TryFrom for NativeTransactionHeader { + type Error = RadixEngineToolkitError; + + fn try_from(value: TransactionHeader) -> Result { + Ok(Self { + network_id: value.network_id, + start_epoch_inclusive: NativeEpoch::of(value.start_epoch_inclusive), + end_epoch_exclusive: NativeEpoch::of(value.end_epoch_exclusive), + nonce: value.nonce, + notary_public_key: value.notary_public_key.try_into()?, + notary_is_signatory: value.notary_is_signatory, + tip_percentage: value.tip_percentage, + }) + } +} + +impl From for TransactionHeader { + fn from(value: NativeTransactionHeader) -> Self { + Self { + network_id: value.network_id, + start_epoch_inclusive: value.start_epoch_inclusive.number(), + end_epoch_exclusive: value.end_epoch_exclusive.number(), + nonce: value.nonce, + notary_public_key: value.notary_public_key.into(), + notary_is_signatory: value.notary_is_signatory, + tip_percentage: value.tip_percentage, + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/transaction/instruction.rs b/radix-engine-toolkit-uniffi/src/transaction/instruction.rs new file mode 100644 index 00000000..7e7e54d7 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/instruction.rs @@ -0,0 +1,496 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Enum)] +pub enum Instruction { + TakeAllFromWorktop { + resource_address: Arc
, + }, + + TakeFromWorktop { + resource_address: Arc
, + amount: Arc, + }, + + TakeNonFungiblesFromWorktop { + resource_address: Arc
, + ids: Vec, + }, + + ReturnToWorktop { + bucket_id: ManifestBucket, + }, + + AssertWorktopContains { + resource_address: Arc
, + amount: Arc, + }, + + AssertWorktopContainsAny { + resource_address: Arc
, + }, + + AssertWorktopContainsNonFungibles { + resource_address: Arc
, + ids: Vec, + }, + + PopFromAuthZone, + + PushToAuthZone { + proof_id: ManifestProof, + }, + + ClearAuthZone, + + CreateProofFromAuthZoneOfAmount { + resource_address: Arc
, + amount: Arc, + }, + + CreateProofFromAuthZoneOfNonFungibles { + resource_address: Arc
, + ids: Vec, + }, + + CreateProofFromAuthZoneOfAll { + resource_address: Arc
, + }, + + ClearSignatureProofs, + + CreateProofFromBucketOfAmount { + bucket_id: ManifestBucket, + amount: Arc, + }, + + CreateProofFromBucketOfNonFungibles { + bucket_id: ManifestBucket, + ids: Vec, + }, + + CreateProofFromBucketOfAll { + bucket_id: ManifestBucket, + }, + + BurnResource { + bucket_id: ManifestBucket, + }, + + CloneProof { + proof_id: ManifestProof, + }, + + DropProof { + proof_id: ManifestProof, + }, + + CallFunction { + package_address: ManifestAddress, + blueprint_name: String, + function_name: String, + args: ManifestValue, + }, + + CallMethod { + address: ManifestAddress, + method_name: String, + args: ManifestValue, + }, + + CallRoyaltyMethod { + address: ManifestAddress, + method_name: String, + args: ManifestValue, + }, + + CallMetadataMethod { + address: ManifestAddress, + method_name: String, + args: ManifestValue, + }, + + CallAccessRulesMethod { + address: ManifestAddress, + method_name: String, + args: ManifestValue, + }, + + CallDirectVaultMethod { + address: Arc
, + method_name: String, + args: ManifestValue, + }, + + DropAllProofs, + + AllocateGlobalAddress { + package_address: Arc
, + blueprint_name: String, + }, +} + +impl Instruction { + pub fn from_native(native: &NativeInstruction, network_id: u8) -> Self { + match native { + NativeInstruction::TakeAllFromWorktop { resource_address } => { + Self::TakeAllFromWorktop { + resource_address: Arc::new(Address::from_node_id( + *resource_address, + network_id, + )), + } + } + NativeInstruction::TakeFromWorktop { + resource_address, + amount, + } => Self::TakeFromWorktop { + resource_address: Arc::new(Address::from_node_id(*resource_address, network_id)), + amount: Arc::new(Decimal(*amount)), + }, + NativeInstruction::TakeNonFungiblesFromWorktop { + resource_address, + ids, + } => Self::TakeNonFungiblesFromWorktop { + resource_address: Arc::new(Address::from_node_id(*resource_address, network_id)), + ids: ids.iter().cloned().map(Into::into).collect(), + }, + + NativeInstruction::ReturnToWorktop { bucket_id } => Self::ReturnToWorktop { + bucket_id: (*bucket_id).into(), + }, + + NativeInstruction::AssertWorktopContains { + resource_address, + amount, + } => Self::AssertWorktopContains { + resource_address: Arc::new(Address::from_node_id(*resource_address, network_id)), + amount: Arc::new(Decimal(*amount)), + }, + NativeInstruction::AssertWorktopContainsAny { resource_address } => { + Self::AssertWorktopContainsAny { + resource_address: Arc::new(Address::from_node_id( + *resource_address, + network_id, + )), + } + } + NativeInstruction::AssertWorktopContainsNonFungibles { + resource_address, + ids, + } => Self::AssertWorktopContainsNonFungibles { + resource_address: Arc::new(Address::from_node_id(*resource_address, network_id)), + ids: ids.iter().cloned().map(Into::into).collect(), + }, + NativeInstruction::PopFromAuthZone => Self::PopFromAuthZone, + NativeInstruction::PushToAuthZone { proof_id } => Self::PushToAuthZone { + proof_id: (*proof_id).into(), + }, + NativeInstruction::ClearAuthZone => Self::ClearAuthZone, + NativeInstruction::ClearSignatureProofs => Self::ClearSignatureProofs, + NativeInstruction::CreateProofFromAuthZoneOfAll { resource_address } => { + Self::CreateProofFromAuthZoneOfAll { + resource_address: Arc::new(Address::from_node_id( + *resource_address, + network_id, + )), + } + } + NativeInstruction::CreateProofFromAuthZoneOfAmount { + resource_address, + amount, + } => Self::CreateProofFromAuthZoneOfAmount { + resource_address: Arc::new(Address::from_node_id(*resource_address, network_id)), + amount: Arc::new(Decimal(*amount)), + }, + NativeInstruction::CreateProofFromAuthZoneOfNonFungibles { + resource_address, + ids, + } => Self::CreateProofFromAuthZoneOfNonFungibles { + resource_address: Arc::new(Address::from_node_id(*resource_address, network_id)), + ids: ids.iter().cloned().map(Into::into).collect(), + }, + NativeInstruction::CreateProofFromBucketOfAll { bucket_id } => { + Self::CreateProofFromBucketOfAll { + bucket_id: (*bucket_id).into(), + } + } + NativeInstruction::CreateProofFromBucketOfAmount { bucket_id, amount } => { + Self::CreateProofFromBucketOfAmount { + bucket_id: (*bucket_id).into(), + amount: Arc::new(Decimal(*amount)), + } + } + NativeInstruction::CreateProofFromBucketOfNonFungibles { bucket_id, ids } => { + Self::CreateProofFromBucketOfNonFungibles { + bucket_id: (*bucket_id).into(), + ids: ids.iter().cloned().map(Into::into).collect(), + } + } + NativeInstruction::BurnResource { bucket_id } => Self::BurnResource { + bucket_id: (*bucket_id).into(), + }, + NativeInstruction::CloneProof { proof_id } => Self::CloneProof { + proof_id: (*proof_id).into(), + }, + NativeInstruction::DropProof { proof_id } => Self::DropProof { + proof_id: (*proof_id).into(), + }, + NativeInstruction::DropAllProofs => Self::DropAllProofs, + NativeInstruction::AllocateGlobalAddress { + package_address, + blueprint_name, + } => Self::AllocateGlobalAddress { + package_address: Arc::new(Address::from_node_id(*package_address, network_id)), + blueprint_name: blueprint_name.clone(), + }, + NativeInstruction::CallFunction { + package_address, + blueprint_name, + function_name, + args, + } => Self::CallFunction { + package_address: ManifestAddress::from_dynamic_package_address( + package_address, + network_id, + ), + blueprint_name: blueprint_name.to_owned(), + function_name: function_name.to_owned(), + args: ManifestValue::from_native(args, network_id), + }, + NativeInstruction::CallMethod { + address, + method_name, + args, + } => Self::CallMethod { + address: ManifestAddress::from_dynamic_global_address(address, network_id), + method_name: method_name.to_owned(), + args: ManifestValue::from_native(args, network_id), + }, + NativeInstruction::CallMetadataMethod { + address, + method_name, + args, + } => Self::CallMetadataMethod { + address: ManifestAddress::from_dynamic_global_address(address, network_id), + method_name: method_name.to_owned(), + args: ManifestValue::from_native(args, network_id), + }, + NativeInstruction::CallAccessRulesMethod { + address, + method_name, + args, + } => Self::CallAccessRulesMethod { + address: ManifestAddress::from_dynamic_global_address(address, network_id), + method_name: method_name.to_owned(), + args: ManifestValue::from_native(args, network_id), + }, + NativeInstruction::CallRoyaltyMethod { + address, + method_name, + args, + } => Self::CallRoyaltyMethod { + address: ManifestAddress::from_dynamic_global_address(address, network_id), + method_name: method_name.to_owned(), + args: ManifestValue::from_native(args, network_id), + }, + NativeInstruction::CallDirectVaultMethod { + address, + method_name, + args, + } => Self::CallDirectVaultMethod { + address: Arc::new(Address::from_node_id(*address, network_id)), + method_name: method_name.to_owned(), + args: ManifestValue::from_native(args, network_id), + }, + } + } + + pub fn to_native(&self) -> Result { + let value = match self { + Self::TakeAllFromWorktop { resource_address } => { + NativeInstruction::TakeAllFromWorktop { + resource_address: (*resource_address.as_ref()).try_into()?, + } + } + Self::TakeFromWorktop { + resource_address, + amount, + } => NativeInstruction::TakeFromWorktop { + resource_address: (*resource_address.as_ref()).try_into()?, + amount: amount.0, + }, + Self::TakeNonFungiblesFromWorktop { + resource_address, + ids, + } => NativeInstruction::TakeNonFungiblesFromWorktop { + resource_address: (*resource_address.as_ref()).try_into()?, + ids: ids + .iter() + .cloned() + .map(TryInto::try_into) + .collect::>()?, + }, + Self::ReturnToWorktop { bucket_id } => NativeInstruction::ReturnToWorktop { + bucket_id: (*bucket_id).into(), + }, + Self::AssertWorktopContains { + resource_address, + amount, + } => NativeInstruction::AssertWorktopContains { + resource_address: (*resource_address.as_ref()).try_into()?, + amount: amount.0, + }, + Self::AssertWorktopContainsAny { resource_address } => { + NativeInstruction::AssertWorktopContainsAny { + resource_address: (*resource_address.as_ref()).try_into()?, + } + } + Self::AssertWorktopContainsNonFungibles { + resource_address, + ids, + } => NativeInstruction::AssertWorktopContainsNonFungibles { + resource_address: (*resource_address.as_ref()).try_into()?, + ids: ids + .iter() + .cloned() + .map(TryInto::try_into) + .collect::>()?, + }, + Self::PopFromAuthZone => NativeInstruction::PopFromAuthZone, + Self::PushToAuthZone { proof_id } => NativeInstruction::PushToAuthZone { + proof_id: (*proof_id).into(), + }, + Self::ClearAuthZone => NativeInstruction::ClearAuthZone, + Self::CreateProofFromAuthZoneOfAll { resource_address } => { + NativeInstruction::CreateProofFromAuthZoneOfAll { + resource_address: (*resource_address.as_ref()).try_into()?, + } + } + Self::CreateProofFromAuthZoneOfAmount { + resource_address, + amount, + } => NativeInstruction::CreateProofFromAuthZoneOfAmount { + resource_address: (*resource_address.as_ref()).try_into()?, + amount: amount.0, + }, + Self::CreateProofFromAuthZoneOfNonFungibles { + resource_address, + ids, + } => NativeInstruction::CreateProofFromAuthZoneOfNonFungibles { + resource_address: (*resource_address.as_ref()).try_into()?, + ids: ids + .iter() + .cloned() + .map(TryInto::try_into) + .collect::>()?, + }, + Self::ClearSignatureProofs => NativeInstruction::ClearSignatureProofs, + Self::CreateProofFromBucketOfAll { bucket_id } => { + NativeInstruction::CreateProofFromBucketOfAll { + bucket_id: (*bucket_id).into(), + } + } + Self::CreateProofFromBucketOfAmount { bucket_id, amount } => { + NativeInstruction::CreateProofFromBucketOfAmount { + bucket_id: (*bucket_id).into(), + amount: amount.0, + } + } + Self::CreateProofFromBucketOfNonFungibles { bucket_id, ids } => { + NativeInstruction::CreateProofFromBucketOfNonFungibles { + bucket_id: (*bucket_id).into(), + ids: ids + .iter() + .cloned() + .map(TryInto::try_into) + .collect::>()?, + } + } + Self::BurnResource { bucket_id } => NativeInstruction::BurnResource { + bucket_id: (*bucket_id).into(), + }, + Self::CloneProof { proof_id } => NativeInstruction::CloneProof { + proof_id: (*proof_id).into(), + }, + Self::DropProof { proof_id } => NativeInstruction::DropProof { + proof_id: (*proof_id).into(), + }, + Self::DropAllProofs => NativeInstruction::DropAllProofs, + Self::CallFunction { + package_address, + blueprint_name, + function_name, + args, + } => NativeInstruction::CallFunction { + package_address: package_address.clone().try_into()?, + blueprint_name: blueprint_name.to_string(), + function_name: function_name.to_string(), + args: args.to_native()?, + }, + Self::CallMethod { + address, + method_name, + args, + } => NativeInstruction::CallMethod { + address: address.clone().try_into()?, + method_name: method_name.to_owned(), + args: args.to_native()?, + }, + Self::CallMetadataMethod { + address, + method_name, + args, + } => NativeInstruction::CallMetadataMethod { + address: address.clone().try_into()?, + method_name: method_name.to_owned(), + args: args.to_native()?, + }, + Self::CallAccessRulesMethod { + address, + method_name, + args, + } => NativeInstruction::CallAccessRulesMethod { + address: address.clone().try_into()?, + method_name: method_name.to_owned(), + args: args.to_native()?, + }, + Self::CallRoyaltyMethod { + address, + method_name, + args, + } => NativeInstruction::CallRoyaltyMethod { + address: address.clone().try_into()?, + method_name: method_name.to_owned(), + args: args.to_native()?, + }, + Self::CallDirectVaultMethod { + address, + method_name, + args, + } => NativeInstruction::CallDirectVaultMethod { + address: address.as_ref().0 .0.try_into()?, + method_name: method_name.to_owned(), + args: args.to_native()?, + }, + _ => todo!(), + }; + Ok(value) + } +} diff --git a/radix-engine-toolkit-uniffi/src/transaction/instructions.rs b/radix-engine-toolkit-uniffi/src/transaction/instructions.rs new file mode 100644 index 00000000..5412bbdf --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/instructions.rs @@ -0,0 +1,58 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Object)] +pub struct Instructions(pub(crate) Vec, pub(crate) u8); + +#[uniffi::export] +impl Instructions { + #[uniffi::constructor] + pub fn from_string(string: String, network_id: u8) -> Result> { + let network_definition = core_network_definition_from_network_id(network_id); + let blob_provider = NativeMockBlobProvider::new(); + native_compile(&string, &network_definition, blob_provider) + .map_err(Into::into) + .map(|manifest| Arc::new(Self(manifest.instructions, network_id))) + } + + #[uniffi::constructor] + pub fn from_instructions(instructions: Vec, network_id: u8) -> Result> { + let instructions = instructions + .into_iter() + .map(|instruction| instruction.to_native()) + .collect::>()?; + Ok(Arc::new(Self(instructions, network_id))) + } + + pub fn as_str(&self) -> Result { + let network_definition = core_network_definition_from_network_id(self.1); + native_decompile(&self.0, &network_definition).map_err(Into::into) + } + + pub fn instructions_list(&self) -> Vec { + self.0 + .iter() + .map(|instruction| Instruction::from_native(instruction, self.1)) + .collect() + } + + pub fn network_id(&self) -> u8 { + self.1 + } +} diff --git a/radix-engine-toolkit-uniffi/src/transaction/intent.rs b/radix-engine-toolkit-uniffi/src/transaction/intent.rs new file mode 100644 index 00000000..f781e2c9 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/intent.rs @@ -0,0 +1,142 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Object)] +pub struct Intent { + pub header: TransactionHeader, + pub manifest: Arc, + pub message: Message, +} + +#[uniffi::export] +impl Intent { + #[uniffi::constructor] + pub fn new( + header: TransactionHeader, + manifest: Arc, + message: Message, + ) -> Arc { + Arc::new(Self { + header, + manifest, + message, + }) + } + + #[uniffi::constructor] + pub fn decompile(compiled_intent: Vec) -> Result> { + core_intent_decompile(compiled_intent) + .map(|intent| Arc::new(intent.into())) + .map_err(Into::into) + } + + pub fn header(&self) -> TransactionHeader { + self.header.clone() + } + + pub fn manifest(&self) -> Arc { + self.manifest.clone() + } + + pub fn message(&self) -> Message { + self.message.clone() + } + + pub fn hash(&self) -> Result> { + NativeIntent::try_from(self.clone()).and_then(|intent| { + core_intent_hash(&intent).map_err(Into::into).map(|hash| { + let intent_hash = NativeIntentHash(hash); + Arc::new(TransactionHash::new(&intent_hash, self.header.network_id)) + }) + }) + } + + pub fn intent_hash(&self) -> Result> { + self.hash() + } + + pub fn compile(&self) -> Result> { + NativeIntent::try_from(self.clone()) + .and_then(|intent| core_intent_compile(&intent).map_err(Into::into)) + } + + pub fn statically_validate(&self, validation_config: Arc) -> Result<()> { + core_intent_statically_validate( + &self.clone().try_into()?, + validation_config.as_ref().clone().into(), + ) + .map_err(Into::into) + } +} + +impl From for Intent { + fn from( + NativeIntent { + blobs, + header, + instructions, + message, + }: NativeIntent, + ) -> Self { + let blobs = blobs.blobs; + let instructions = instructions.0; + let manifest = NativeTransactionManifest { + instructions, + blobs: blobs + .iter() + .map(|blob| (native_hash(&blob.0), blob.0.clone())) + .collect::>(), + }; + + Self { + manifest: Arc::new(TransactionManifest::from_native( + &manifest, + header.network_id, + )), + header: header.into(), + message: message.into(), + } + } +} + +impl TryFrom for NativeIntent { + type Error = RadixEngineToolkitError; + + fn try_from(value: Intent) -> Result { + let blobs = NativeBlobs { + blobs: value + .manifest + .blobs + .iter() + .cloned() + .map(NativeBlob) + .collect(), + }; + let instructions = NativeInstructions(value.manifest.instructions.0.clone()); + let header = value.header.try_into()?; + let message = value.message.try_into()?; + + Ok(Self { + blobs, + message, + header, + instructions, + }) + } +} diff --git a/radix-engine-toolkit-uniffi/src/transaction/manifest.rs b/radix-engine-toolkit-uniffi/src/transaction/manifest.rs new file mode 100644 index 00000000..a86a61b5 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/manifest.rs @@ -0,0 +1,385 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Object)] +pub struct TransactionManifest { + pub instructions: Arc, + pub blobs: Vec>, +} + +#[uniffi::export] +impl TransactionManifest { + #[uniffi::constructor] + pub fn new(instructions: Arc, blobs: Vec>) -> Arc { + Arc::new(Self { + instructions, + blobs, + }) + } + + pub fn instructions(&self) -> Arc { + self.instructions.clone() + } + + pub fn blobs(&self) -> Vec> { + self.blobs.clone() + } + + pub fn statically_validate(&self) -> Result<()> { + core_instructions_statically_validate(&self.instructions.0)?; + core_manifest_statically_validate(&self.to_native())?; + Ok(()) + } + + pub fn extract_addresses(&self) -> HashMap>> { + let network_id = self.instructions.1; + let (addresses, _) = core_instructions_extract_addresses(&self.instructions.0); + + let mut map = HashMap::>>::new(); + for address in addresses { + let entity_type = EntityType::from(address.entity_type().unwrap()); + let address = Arc::new(Address(address, network_id)); + map.entry(entity_type).or_default().push(address); + } + map + } + + pub fn identities_requiring_auth(&self) -> Vec> { + core_instructions_identities_requiring_auth(&self.instructions.0) + .into_iter() + .map(|address| Arc::new(Address::from_node_id(address, self.instructions.1))) + .collect() + } + + pub fn accounts_requiring_auth(&self) -> Vec> { + core_instructions_accounts_requiring_auth(&self.instructions.0) + .into_iter() + .map(|address| Arc::new(Address::from_node_id(address, self.instructions.1))) + .collect() + } + + pub fn accounts_withdrawn_from(&self) -> Vec> { + core_instructions_accounts_withdrawn_from(&self.instructions.0) + .into_iter() + .map(|address| Arc::new(Address::from_node_id(address, self.instructions.1))) + .collect() + } + + pub fn accounts_deposited_into(&self) -> Vec> { + core_instructions_accounts_deposited_into(&self.instructions.0) + .into_iter() + .map(|address| Arc::new(Address::from_node_id(address, self.instructions.1))) + .collect() + } +} + +impl TransactionManifest { + pub fn from_native( + NativeTransactionManifest { + instructions, + blobs, + }: &NativeTransactionManifest, + network_id: u8, + ) -> Self { + let blobs = blobs.iter().map(|(_, v)| v.clone()).collect::>(); + let instructions = Instructions(instructions.clone(), network_id); + Self { + instructions: Arc::new(instructions), + blobs, + } + } + + pub fn to_native(&self) -> NativeTransactionManifest { + let blobs = self + .blobs + .iter() + .map(|blob| (native_hash(blob), blob.clone())) + .collect::>(); + let instructions = self.instructions.0.clone(); + + NativeTransactionManifest { + instructions, + blobs, + } + } +} + +#[derive(Clone, Debug, Record)] +pub struct ExecutionAnalysis { + pub fee_locks: FeeLocks, + pub fee_summary: FeeSummary, + pub transaction_type: TransactionType, +} + +#[derive(Clone, Debug, Record)] +pub struct FeeSummary { + pub network_fee: Arc, + pub royalty_fee: Arc, +} + +#[derive(Clone, Debug, Record)] +pub struct FeeLocks { + pub lock: Arc, + pub contingent_lock: Arc, +} + +#[allow(clippy::large_enum_variant)] // TODO: Consider complying with this +#[derive(Clone, Debug, Enum)] +pub enum TransactionType { + SimpleTransfer { + from: Arc
, + to: Arc
, + transferred: ResourceSpecifier, + }, + Transfer { + from: Arc
, + transfers: HashMap>, + }, + GeneralTransaction { + account_proofs: Vec>, + account_withdraws: HashMap>, + account_deposits: HashMap>, + addresses_in_manifest: HashMap>>, + metadata_of_newly_created_entities: HashMap>, + data_of_newly_minted_non_fungibles: HashMap>>, + }, + NonConforming, +} + +#[derive(Clone, Debug, Enum)] +pub enum ResourceSpecifier { + Amount { + resource_address: Arc
, + amount: Arc, + }, + Ids { + resource_address: Arc
, + ids: Vec, + }, +} + +#[derive(Clone, Debug, Enum)] +pub enum Source { + Guaranteed { + value: ResourceSpecifier, + }, + Predicted { + instruction_index: u64, + value: ResourceSpecifier, + }, +} + +#[derive(Clone, Debug, Enum)] +pub enum Resources { + Amount { amount: Arc }, + Ids { ids: Vec }, +} + +impl Resources { + pub fn from_native(native: &CoreResources) -> Self { + match native { + CoreResources::Amount(value) => Self::Amount { + amount: Arc::new(Decimal(*value)), + }, + CoreResources::Ids(value) => Self::Ids { + ids: value.iter().cloned().map(Into::into).collect(), + }, + } + } +} + +impl ResourceSpecifier { + pub fn from_native(native: &NativeResourceSpecifier, network_id: u8) -> ResourceSpecifier { + match native { + NativeResourceSpecifier::Amount(resource_address, amount) => Self::Amount { + resource_address: Arc::new(Address(resource_address.into_node_id(), network_id)), + amount: Arc::new(Decimal(*amount)), + }, + NativeResourceSpecifier::Ids(resource_address, ids) => Self::Ids { + resource_address: Arc::new(Address(resource_address.into_node_id(), network_id)), + ids: ids.iter().cloned().map(Into::into).collect(), + }, + } + } +} + +impl Source { + pub fn from_native(native: &CoreSource, network_id: u8) -> Self { + match native { + CoreSource::Guaranteed(value) => Source::Guaranteed { + value: ResourceSpecifier::from_native(value, network_id), + }, + CoreSource::Predicted(instruction_index, value) => Source::Predicted { + instruction_index: *instruction_index as u64, + value: ResourceSpecifier::from_native(value, network_id), + }, + } + } +} + +impl TransactionType { + pub fn from_native(native: &CoreExecutionTransactionType, network_id: u8) -> Self { + match native { + CoreExecutionTransactionType::NonConforming => Self::NonConforming, + CoreExecutionTransactionType::SimpleTransfer(value) => { + let CoreExecutionSimpleTransferTransactionType { + from, + to, + transferred, + } = value.as_ref(); + + Self::SimpleTransfer { + from: Arc::new(Address::from_node_id(*from, network_id)), + to: Arc::new(Address::from_node_id(*to, network_id)), + transferred: ResourceSpecifier::from_native(transferred, network_id), + } + } + CoreExecutionTransactionType::Transfer(value) => { + let CoreExecutionTransferTransactionType { from, transfers } = value.as_ref(); + + Self::Transfer { + from: Arc::new(Address::from_node_id(*from, network_id)), + transfers: transfers + .iter() + .map(|(key, value)| { + ( + Address::from_node_id(*key, network_id).as_str(), + value + .iter() + .map(|(key, value)| { + ( + Address::from_node_id(*key, network_id).as_str(), + Resources::from_native(value), + ) + }) + .collect(), + ) + }) + .collect(), + } + } + CoreExecutionTransactionType::GeneralTransaction(value) => { + let CoreExecutionGeneralTransactionType { + account_proofs, + account_withdraws, + account_deposits, + addresses_in_manifest: (addresses_in_manifest, _), + metadata_of_newly_created_entities, + data_of_newly_minted_non_fungibles, + } = value.as_ref(); + + Self::GeneralTransaction { + account_proofs: account_proofs + .iter() + .map(|value| Arc::new(Address::from_node_id(*value, network_id))) + .collect(), + account_withdraws: account_withdraws + .iter() + .map(|(key, value)| { + ( + Address::from_node_id(*key, network_id).as_str(), + value + .iter() + .map(|value| ResourceSpecifier::from_native(value, network_id)) + .collect(), + ) + }) + .collect(), + account_deposits: account_deposits + .iter() + .map(|(key, value)| { + ( + Address::from_node_id(*key, network_id).as_str(), + value + .iter() + .map(|value| Source::from_native(value, network_id)) + .collect(), + ) + }) + .collect(), + addresses_in_manifest: { + let mut map = HashMap::>>::new(); + for address in addresses_in_manifest { + let entity_type = EntityType::from(address.entity_type().unwrap()); + let address = Arc::new(Address(*address, network_id)); + map.entry(entity_type).or_default().push(address); + } + map + }, + metadata_of_newly_created_entities: metadata_of_newly_created_entities + .iter() + .map(|(key, value)| { + ( + Address::from_node_id(*key, network_id).as_str(), + value + .iter() + .map(|(key, value)| { + (key.clone(), MetadataValue::from_native(value, network_id)) + }) + .collect(), + ) + }) + .collect(), + data_of_newly_minted_non_fungibles: data_of_newly_minted_non_fungibles + .iter() + .map(|(key, value)| { + ( + Address::from_node_id(*key, network_id).as_str(), + value + .iter() + .map(|(key, value)| { + (key.clone().into(), native_scrypto_encode(value).unwrap()) + }) + .collect(), + ) + }) + .collect(), + } + } + } + } +} + +impl FeeLocks { + pub fn from_native( + CoreExecutionFeeLocks { + contingent_lock, + lock, + }: &CoreExecutionFeeLocks, + ) -> Self { + Self { + contingent_lock: Arc::new(Decimal(*contingent_lock)), + lock: Arc::new(Decimal(*lock)), + } + } +} + +impl FeeSummary { + pub fn from_native( + CoreExecutionFeeSummary { + network_fee, + royalty_fee, + }: &CoreExecutionFeeSummary, + ) -> Self { + Self { + network_fee: Arc::new(Decimal(*network_fee)), + royalty_fee: Arc::new(Decimal(*royalty_fee)), + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/transaction/message.rs b/radix-engine-toolkit-uniffi/src/transaction/message.rs new file mode 100644 index 00000000..9564e43a --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/message.rs @@ -0,0 +1,284 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Enum)] +pub enum Message { + None, + PlainText { value: PlainTextMessage }, + Encrypted { value: EncryptedMessage }, +} + +#[derive(Clone, Debug, Record)] +pub struct PlainTextMessage { + pub mime_type: String, + pub message: MessageContent, +} + +#[derive(Clone, Debug, Enum)] +pub enum MessageContent { + Str { value: String }, + Bytes { value: Vec }, +} + +#[derive(Clone, Debug, Record)] +pub struct EncryptedMessage { + pub encrypted: Vec, + pub decryptors_by_curve: HashMap, +} + +#[derive(Clone, Debug, Enum, Hash, PartialEq, Eq)] +pub enum CurveType { + Ed25519, + Secp256k1, +} + +#[derive(Clone, Debug, Enum)] +pub enum DecryptorsByCurve { + Ed25519 { + dh_ephemeral_public_key: Ed25519PublicKey, + decryptors: HashMap, + }, + Secp256k1 { + dh_ephemeral_public_key: Secp256k1PublicKey, + decryptors: HashMap, + }, +} + +pub type AesWrapped128BitKey = Vec; +pub type PublicKeyFingerprint = Vec; + +//================== +// From Trait Impls +//================== + +impl From for DecryptorsByCurve { + fn from(value: NativeDecryptorsByCurve) -> Self { + match value { + NativeDecryptorsByCurve::Secp256k1 { + dh_ephemeral_public_key, + decryptors, + } => Self::Secp256k1 { + dh_ephemeral_public_key: dh_ephemeral_public_key.into(), + decryptors: decryptors + .into_iter() + .map(|(key, value)| (key.0.into(), value.0.into())) + .collect(), + }, + NativeDecryptorsByCurve::Ed25519 { + dh_ephemeral_public_key, + decryptors, + } => Self::Ed25519 { + dh_ephemeral_public_key: dh_ephemeral_public_key.into(), + decryptors: decryptors + .into_iter() + .map(|(key, value)| (key.0.into(), value.0.into())) + .collect(), + }, + } + } +} + +impl TryFrom for NativeDecryptorsByCurve { + type Error = RadixEngineToolkitError; + + fn try_from(value: DecryptorsByCurve) -> Result { + match value { + DecryptorsByCurve::Ed25519 { + dh_ephemeral_public_key, + decryptors, + } => Ok(Self::Ed25519 { + dh_ephemeral_public_key: dh_ephemeral_public_key.try_into()?, + decryptors: decryptors + .into_iter() + .map(|(key, value)| { + key.try_into() + .map(NativePublicKeyFingerprint) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeSecp256k1PublicKey::LENGTH as u64, + actual: value.len() as u64, + data: value, + }) + .and_then(|key| { + value + .try_into() + .map(NativeAesWrapped128BitKey) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeSecp256k1PublicKey::LENGTH as u64, + actual: value.len() as u64, + data: value, + }) + .map(|value| (key, value)) + }) + }) + .collect::>()?, + }), + DecryptorsByCurve::Secp256k1 { + dh_ephemeral_public_key, + decryptors, + } => Ok(Self::Secp256k1 { + dh_ephemeral_public_key: dh_ephemeral_public_key.try_into()?, + decryptors: decryptors + .into_iter() + .map(|(key, value)| { + key.try_into() + .map(NativePublicKeyFingerprint) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeSecp256k1PublicKey::LENGTH as u64, + actual: value.len() as u64, + data: value, + }) + .and_then(|key| { + value + .try_into() + .map(NativeAesWrapped128BitKey) + .map_err(|value| RadixEngineToolkitError::InvalidLength { + expected: NativeSecp256k1PublicKey::LENGTH as u64, + actual: value.len() as u64, + data: value, + }) + .map(|value| (key, value)) + }) + }) + .collect::>()?, + }), + } + } +} + +impl From for NativeCurveType { + fn from(value: CurveType) -> Self { + match value { + CurveType::Ed25519 => Self::Ed25519, + CurveType::Secp256k1 => Self::Secp256k1, + } + } +} + +impl From for CurveType { + fn from(value: NativeCurveType) -> Self { + match value { + NativeCurveType::Ed25519 => Self::Ed25519, + NativeCurveType::Secp256k1 => Self::Secp256k1, + } + } +} + +impl From for EncryptedMessage { + fn from( + NativeEncryptedMessage { + encrypted, + decryptors_by_curve, + }: NativeEncryptedMessage, + ) -> Self { + let encrypted = encrypted.0; + let decryptors_by_curve = decryptors_by_curve + .into_iter() + .map(|(k, v)| (k.into(), v.into())) + .collect(); + + Self { + encrypted, + decryptors_by_curve, + } + } +} + +impl TryFrom for NativeEncryptedMessage { + type Error = RadixEngineToolkitError; + + fn try_from( + EncryptedMessage { + encrypted, + decryptors_by_curve, + }: EncryptedMessage, + ) -> Result { + let encrypted = NativeAesGcmPayload(encrypted); + let decryptors_by_curve = decryptors_by_curve + .into_iter() + .map(|(k, v)| v.try_into().map(|v| (k.into(), v))) + .collect::>()?; + + Ok(Self { + encrypted, + decryptors_by_curve, + }) + } +} + +impl From for NativeMessageContents { + fn from(value: MessageContent) -> Self { + match value { + MessageContent::Str { value } => Self::String(value), + MessageContent::Bytes { value } => Self::Bytes(value), + } + } +} + +impl From for MessageContent { + fn from(value: NativeMessageContents) -> Self { + match value { + NativeMessageContents::String(value) => Self::Str { value }, + NativeMessageContents::Bytes(value) => Self::Bytes { value }, + } + } +} + +impl From for NativePlaintextMessage { + fn from(PlainTextMessage { message, mime_type }: PlainTextMessage) -> Self { + Self { + message: message.into(), + mime_type, + } + } +} + +impl From for PlainTextMessage { + fn from(NativePlaintextMessage { message, mime_type }: NativePlaintextMessage) -> Self { + Self { + message: message.into(), + mime_type, + } + } +} + +impl TryFrom for NativeMessage { + type Error = RadixEngineToolkitError; + + fn try_from(value: Message) -> Result { + match value { + Message::None => Ok(NativeMessage::None), + Message::Encrypted { value } => value.try_into().map(NativeMessage::Encrypted), + Message::PlainText { value } => Ok(NativeMessage::Plaintext(value.into())), + } + } +} + +impl From for Message { + fn from(value: NativeMessage) -> Self { + match value { + NativeMessage::None => Self::None, + NativeMessage::Encrypted(value) => Self::Encrypted { + value: value.into(), + }, + NativeMessage::Plaintext(value) => Self::PlainText { + value: value.into(), + }, + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/transaction/mod.rs b/radix-engine-toolkit-uniffi/src/transaction/mod.rs new file mode 100644 index 00000000..d796cfe5 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/mod.rs @@ -0,0 +1,27 @@ +// 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 hash; +pub mod header; +pub mod instruction; +pub mod instructions; +pub mod intent; +pub mod manifest; +pub mod message; +pub mod notarized_transaction; +pub mod signed_intent; +pub mod validation; diff --git a/radix-engine-toolkit-uniffi/src/transaction/notarized_transaction.rs b/radix-engine-toolkit-uniffi/src/transaction/notarized_transaction.rs new file mode 100644 index 00000000..b1571927 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/notarized_transaction.rs @@ -0,0 +1,121 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Object)] +pub struct NotarizedTransaction { + pub signed_intent: Arc, + pub notary_signature: Signature, +} + +#[uniffi::export] +impl NotarizedTransaction { + #[uniffi::constructor] + pub fn new(signed_intent: Arc, notary_signature: Signature) -> Arc { + Arc::new(Self { + signed_intent, + notary_signature, + }) + } + + #[uniffi::constructor] + pub fn decompile(compiled_notarized_transaction: Vec) -> Result> { + core_notarized_transaction_decompile(compiled_notarized_transaction) + .map(|notarized_transaction| Arc::new(notarized_transaction.into())) + .map_err(Into::into) + } + + pub fn signed_intent(&self) -> Arc { + self.signed_intent.clone() + } + + pub fn notary_signature(&self) -> Signature { + self.notary_signature.clone() + } + + pub fn hash(&self) -> Result> { + NativeNotarizedTransaction::try_from(self.clone()).and_then(|notarized_transaction| { + core_notarized_transaction_hash(¬arized_transaction) + .map_err(Into::into) + .map(|hash| { + let notarized_transaction_hash = NativeNotarizedTransactionHash(hash); + Arc::new(TransactionHash::new( + ¬arized_transaction_hash, + self.signed_intent.intent.header.network_id, + )) + }) + }) + } + + pub fn notarized_transaction_hash(&self) -> Result> { + self.hash() + } + + pub fn signed_intent_hash(&self) -> Result> { + self.signed_intent.hash() + } + + pub fn intent_hash(&self) -> Result> { + self.signed_intent.intent.hash() + } + + pub fn compile(&self) -> Result> { + NativeNotarizedTransaction::try_from(self.clone()).and_then(|notarized_transaction| { + core_notarized_transaction_compile(¬arized_transaction).map_err(Into::into) + }) + } + + pub fn statically_validate(&self, validation_config: Arc) -> Result<()> { + core_notarized_transaction_statically_validate( + &self.clone().try_into()?, + validation_config.as_ref().clone().into(), + ) + .map_err(Into::into) + } +} + +impl From for NotarizedTransaction { + fn from( + NativeNotarizedTransaction { + notary_signature, + signed_intent, + }: NativeNotarizedTransaction, + ) -> Self { + let signed_intent = SignedIntent::from(signed_intent); + let notary_signature = Signature::from(notary_signature.0); + + Self { + signed_intent: Arc::new(signed_intent), + notary_signature, + } + } +} + +impl TryFrom for NativeNotarizedTransaction { + type Error = RadixEngineToolkitError; + + fn try_from(value: NotarizedTransaction) -> Result { + let signed_intent = NativeSignedIntent::try_from(value.signed_intent.as_ref().clone())?; + let notary_signature = NativeSignature::try_from(value.notary_signature)?; + + Ok(Self { + signed_intent, + notary_signature: NativeNotarySignature(notary_signature), + }) + } +} diff --git a/radix-engine-toolkit-uniffi/src/transaction/signed_intent.rs b/radix-engine-toolkit-uniffi/src/transaction/signed_intent.rs new file mode 100644 index 00000000..055c0d93 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/signed_intent.rs @@ -0,0 +1,127 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Object)] +pub struct SignedIntent { + pub intent: Arc, + pub intent_signatures: Vec, +} + +#[uniffi::export] +impl SignedIntent { + #[uniffi::constructor] + pub fn new(intent: Arc, intent_signatures: Vec) -> Arc { + Arc::new(Self { + intent, + intent_signatures, + }) + } + + #[uniffi::constructor] + pub fn decompile(compiled_signed_intent: Vec) -> Result> { + core_signed_intent_decompile(compiled_signed_intent) + .map(|signed_intent| Arc::new(signed_intent.into())) + .map_err(Into::into) + } + + pub fn intent(&self) -> Arc { + self.intent.clone() + } + + pub fn intent_signatures(&self) -> Vec { + self.intent_signatures.clone() + } + + pub fn hash(&self) -> Result> { + NativeSignedIntent::try_from(self.clone()).and_then(|signed_intent| { + core_signed_intent_hash(&signed_intent) + .map_err(Into::into) + .map(|hash| { + let signed_intent_hash = NativeSignedIntentHash(hash); + Arc::new(TransactionHash::new( + &signed_intent_hash, + self.intent.header.network_id, + )) + }) + }) + } + + pub fn signed_intent_hash(&self) -> Result> { + self.hash() + } + + pub fn intent_hash(&self) -> Result> { + self.intent.hash() + } + + pub fn compile(&self) -> Result> { + NativeSignedIntent::try_from(self.clone()).and_then(|signed_intent| { + core_signed_intent_compile(&signed_intent).map_err(Into::into) + }) + } + + pub fn statically_validate(&self, validation_config: Arc) -> Result<()> { + core_signed_intent_statically_validate( + &self.clone().try_into()?, + validation_config.as_ref().clone().into(), + ) + .map_err(Into::into) + } +} + +impl From for SignedIntent { + fn from( + NativeSignedIntent { + intent, + intent_signatures, + }: NativeSignedIntent, + ) -> Self { + let intent = Intent::from(intent); + let intent_signatures = intent_signatures + .signatures + .into_iter() + .map(|signature| SignatureWithPublicKey::from(signature.0)) + .collect::>(); + + Self { + intent: Arc::new(intent), + intent_signatures, + } + } +} + +impl TryFrom for NativeSignedIntent { + type Error = RadixEngineToolkitError; + + fn try_from(value: SignedIntent) -> Result { + let intent = NativeIntent::try_from(value.intent.as_ref().clone())?; + let intent_signatures = value + .intent_signatures + .into_iter() + .map(|signature| signature.try_into().map(NativeIntentSignature)) + .collect::>>()?; + + Ok(Self { + intent, + intent_signatures: NativeIntentSignatures { + signatures: intent_signatures, + }, + }) + } +} diff --git a/radix-engine-toolkit-uniffi/src/transaction/validation.rs b/radix-engine-toolkit-uniffi/src/transaction/validation.rs new file mode 100644 index 00000000..acff0bfb --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/transaction/validation.rs @@ -0,0 +1,198 @@ +// 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::prelude::*; + +#[derive(Clone, Debug, Object)] +pub struct ValidationConfig { + pub network_id: u8, + pub max_notarized_payload_size: u64, + pub min_cost_unit_limit: u32, + pub max_cost_unit_limit: u32, + pub min_tip_percentage: u16, + pub max_tip_percentage: u16, + pub max_epoch_range: u64, + pub message_validation: Arc, +} + +#[derive(Clone, Debug, Object)] +pub struct MessageValidationConfig { + pub max_plaintext_message_length: u64, + pub max_encrypted_message_length: u64, + pub max_mime_type_length: u64, + pub max_decryptors: u64, +} + +#[uniffi::export] +impl ValidationConfig { + #[allow(clippy::too_many_arguments)] + #[uniffi::constructor] + pub fn new( + network_id: u8, + max_notarized_payload_size: u64, + min_cost_unit_limit: u32, + max_cost_unit_limit: u32, + min_tip_percentage: u16, + max_tip_percentage: u16, + max_epoch_range: u64, + message_validation: Arc, + ) -> Arc { + Arc::new(Self { + network_id, + max_notarized_payload_size, + min_cost_unit_limit, + max_cost_unit_limit, + min_tip_percentage, + max_tip_percentage, + max_epoch_range, + message_validation, + }) + } + + #[uniffi::constructor] + pub fn default(network_id: u8) -> Arc { + Arc::new(NativeValidationConfig::default(network_id).into()) + } + + pub fn network_id(&self) -> u8 { + self.network_id + } + + pub fn max_notarized_payload_size(&self) -> u64 { + self.max_notarized_payload_size + } + + pub fn min_cost_unit_limit(&self) -> u32 { + self.min_cost_unit_limit + } + + pub fn max_cost_unit_limit(&self) -> u32 { + self.max_cost_unit_limit + } + + pub fn min_tip_percentage(&self) -> u16 { + self.min_tip_percentage + } + + pub fn max_tip_percentage(&self) -> u16 { + self.max_tip_percentage + } + + pub fn max_epoch_range(&self) -> u64 { + self.max_epoch_range + } + + pub fn message_validation(&self) -> Arc { + self.message_validation.clone() + } +} + +#[uniffi::export] +impl MessageValidationConfig { + #[uniffi::constructor] + pub fn new( + max_plaintext_message_length: u64, + max_encrypted_message_length: u64, + max_mime_type_length: u64, + max_decryptors: u64, + ) -> Arc { + Arc::new(Self { + max_plaintext_message_length, + max_encrypted_message_length, + max_mime_type_length, + max_decryptors, + }) + } + + #[allow(clippy::should_implement_trait)] + #[uniffi::constructor] + pub fn default() -> Arc { + Arc::new(NativeMessageValidationConfig::default().into()) + } + + pub fn max_plaintext_message_length(&self) -> u64 { + self.max_plaintext_message_length + } + + pub fn max_encrypted_message_length(&self) -> u64 { + self.max_encrypted_message_length + } + + pub fn max_mime_type_length(&self) -> u64 { + self.max_mime_type_length + } + + pub fn max_decryptors(&self) -> u64 { + self.max_decryptors + } +} + +//============ +// From Impls +//============ + +impl From for NativeValidationConfig { + fn from(value: ValidationConfig) -> Self { + Self { + network_id: value.network_id, + max_notarized_payload_size: value.max_notarized_payload_size as usize, + min_cost_unit_limit: value.min_cost_unit_limit, + max_cost_unit_limit: value.max_cost_unit_limit, + min_tip_percentage: value.min_tip_percentage, + max_tip_percentage: value.max_tip_percentage, + max_epoch_range: value.max_epoch_range, + message_validation: value.message_validation.as_ref().clone().into(), + } + } +} + +impl From for ValidationConfig { + fn from(value: NativeValidationConfig) -> Self { + Self { + network_id: value.network_id, + max_notarized_payload_size: value.max_notarized_payload_size as u64, + min_cost_unit_limit: value.min_cost_unit_limit, + max_cost_unit_limit: value.max_cost_unit_limit, + min_tip_percentage: value.min_tip_percentage, + max_tip_percentage: value.max_tip_percentage, + max_epoch_range: value.max_epoch_range, + message_validation: Arc::new(value.message_validation.into()), + } + } +} + +impl From for NativeMessageValidationConfig { + fn from(value: MessageValidationConfig) -> Self { + Self { + max_plaintext_message_length: value.max_plaintext_message_length as usize, + max_encrypted_message_length: value.max_encrypted_message_length as usize, + max_mime_type_length: value.max_mime_type_length as usize, + max_decryptors: value.max_decryptors as usize, + } + } +} + +impl From for MessageValidationConfig { + fn from(value: NativeMessageValidationConfig) -> Self { + Self { + max_plaintext_message_length: value.max_plaintext_message_length as u64, + max_encrypted_message_length: value.max_encrypted_message_length as u64, + max_mime_type_length: value.max_mime_type_length as u64, + max_decryptors: value.max_decryptors as u64, + } + } +} diff --git a/radix-engine-toolkit-uniffi/src/utils/functions.rs b/radix-engine-toolkit-uniffi/src/utils/functions.rs new file mode 100644 index 00000000..9b0f0e02 --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/utils/functions.rs @@ -0,0 +1,114 @@ +// 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::prelude::*; + +#[uniffi::export] +pub fn known_addresses(network_id: u8) -> KnownAddresses { + KnownAddresses { + resource_addresses: ResourceAddresses::new_from_network(network_id), + package_addresses: PackageAddresses::new_from_network(network_id), + component_addresses: ComponentAddresses::new_from_network(network_id), + } +} + +#[uniffi::export] +pub fn hash(data: Vec) -> Arc { + Hash::from_unhashed_bytes(data) +} + +#[derive(Clone, Debug, Record)] +pub struct KnownAddresses { + pub resource_addresses: ResourceAddresses, + pub package_addresses: PackageAddresses, + pub component_addresses: ComponentAddresses, +} + +impl_new_from_network! { + #[derive(Clone, Debug, Record)] + pub struct ResourceAddresses { + pub xrd: Arc
, + pub secp256k1_signature_virtual_badge: Arc
, + pub ed25519_signature_virtual_badge: Arc
, + pub package_of_direct_caller_virtual_badge: Arc
, + pub global_caller_virtual_badge: Arc
, + pub system_transaction_badge: Arc
, + pub package_owner_badge: Arc
, + pub validator_owner_badge: Arc
, + pub account_owner_badge: Arc
, + pub identity_owner_badge: Arc
, + } +} + +impl_new_from_network! { + #[derive(Clone, Debug, Record)] + pub struct PackageAddresses { + pub package_package: Arc
, + pub resource_package: Arc
, + pub account_package: Arc
, + pub identity_package: Arc
, + pub consensus_manager_package: Arc
, + pub access_controller_package: Arc
, + pub pool_package: Arc
, + pub transaction_processor_package: Arc
, + pub metadata_module_package: Arc
, + pub royalty_module_package: Arc
, + pub access_rules_module_package: Arc
, + pub genesis_helper_package: Arc
, + pub faucet_package: Arc
, + } +} + +impl_new_from_network! { + #[derive(Clone, Debug, Record)] + pub struct ComponentAddresses { + pub consensus_manager: Arc
, + pub genesis_helper: Arc
, + pub faucet: Arc
, + } +} + +macro_rules! impl_new_from_network { + ( + $(#[$meta: meta])* + $vis: vis struct $ident: ident { + $( + $item_vis: vis $item_ident: ident: $item_type: ty + ),* $(,)? + } + ) => { + paste::paste! { + $(#[$meta])* + $vis struct $ident { + $( + $item_vis $item_ident: $item_type, + )* + } + + impl $ident { + pub fn new_from_network(network_id: u8) -> Self { + Self { + $( + $item_ident: Arc::new(Address( scrypto::prelude::[< $item_ident: upper >].into_node_id(), network_id )), + )* + } + } + } + } + }; +} +use impl_new_from_network; diff --git a/radix-engine-toolkit-uniffi/src/utils/mod.rs b/radix-engine-toolkit-uniffi/src/utils/mod.rs new file mode 100644 index 00000000..9d79f07c --- /dev/null +++ b/radix-engine-toolkit-uniffi/src/utils/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 functions; diff --git a/radix-engine-toolkit/src/example/transaction/instruction_list.rs b/radix-engine-toolkit-uniffi/tests/binding_generation.rs similarity index 72% rename from radix-engine-toolkit/src/example/transaction/instruction_list.rs rename to radix-engine-toolkit-uniffi/tests/binding_generation.rs index a4bfc677..8ab45f24 100644 --- a/radix-engine-toolkit/src/example/transaction/instruction_list.rs +++ b/radix-engine-toolkit-uniffi/tests/binding_generation.rs @@ -15,12 +15,10 @@ // specific language governing permissions and limitations // under the License. -use crate::model::{instruction::Instruction, transaction::InstructionList}; +//! This module tests the generated bindings to ensure that that they at least compile. If the tests +//! in this module fails then it means that the generated bindings do not compile. -pub fn string() -> InstructionList { - InstructionList::String("DROP_ALL_PROOFS;".to_owned()) -} - -pub fn parsed() -> InstructionList { - InstructionList::Parsed(vec![Instruction::DropAllProofs]) -} +uniffi::build_foreign_language_testcases!( + "tests/bindings/example.swift", + "tests/bindings/example.kts", +); diff --git a/radix-engine-toolkit-uniffi/tests/bindings/example.kts b/radix-engine-toolkit-uniffi/tests/bindings/example.kts new file mode 100644 index 00000000..1e6b1c03 --- /dev/null +++ b/radix-engine-toolkit-uniffi/tests/bindings/example.kts @@ -0,0 +1,7 @@ +import org.radixdlt.ret.*; + +// Act +val information = buildInformation(); + +// Assert +assert(information.version == "0.10.0-elm.1"); \ No newline at end of file diff --git a/radix-engine-toolkit-uniffi/tests/bindings/example.swift b/radix-engine-toolkit-uniffi/tests/bindings/example.swift new file mode 100644 index 00000000..24092849 --- /dev/null +++ b/radix-engine-toolkit-uniffi/tests/bindings/example.swift @@ -0,0 +1,10 @@ +import Foundation +import radix_engine_toolkit_uniffi + +do { + // Act + let buildInformation = radix_engine_toolkit_uniffi.buildInformation() + + // Assert + assert(buildInformation.version == "0.10.0-elm.1") +} diff --git a/radix-engine-toolkit-uniffi/uniffi.toml b/radix-engine-toolkit-uniffi/uniffi.toml new file mode 100644 index 00000000..4c06db62 --- /dev/null +++ b/radix-engine-toolkit-uniffi/uniffi.toml @@ -0,0 +1,5 @@ +[bindings.kotlin] +package_name = "org.radixdlt.ret" + +[bindings.csharp] +namespace_name = "RadixEngineToolkit" \ No newline at end of file diff --git a/radix-engine-toolkit/Cargo.toml b/radix-engine-toolkit/Cargo.toml index c19b82f8..371712bb 100644 --- a/radix-engine-toolkit/Cargo.toml +++ b/radix-engine-toolkit/Cargo.toml @@ -1,45 +1,43 @@ [package] name = "radix-engine-toolkit" -version = "0.9.0" +version = "0.10.0-elm.1" edition = "2021" -build = "build.rs" [dependencies] -# Crates for Serde serialization. -serde = { version = "1.0.152" } -serde_with = { version = "2.2.0", features = ["hex"] } +# radixdlt-scrypto dependencies. +sbor = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +scrypto = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } +transaction = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e" } +radix-engine = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", default-features= false, features = ["std", "lru"] } +radix-engine-common = { git = "https://github.com/radixdlt/radixdlt-scrypto", tag = "rcnet-v2-8fdd53b3e", features = ["serde"] } -# A library which allows us to generate a JSON schema from Rust models -schemars = { version = "0.8.11", features = ["preserve_order"] } +# Core Radix Engine Toolkit +radix-engine-toolkit-core = { path = "../radix-engine-toolkit-core" } -# An attribute macro to setup a model to be serializable and also to have a JSON schema. -toolkit-derive = { path = "../toolkit-derive" } +# Serde for JSON serialization +serde = { version = "1.0.163" } +serde_json = { version = "1.0.96", features = ["preserve_order"] } +serde_with = { version = "3.0.0", features = ["hex"] } +schemars = { version = "0.8.12", features = ["preserve_order"] } -# Scrypto dependencies required for the core-toolkit -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" } +# Bech32 for encoding and decoding addresses +bech32 = { version = "0.9.1" } -# Hex is used for the internal hex encoding and decoding of values - serde_with::Hex is used for the -# hex representation during serialization. -hex = { version = "0.4.3", default-features = false } +# Used to be able to expose the crate to JVM clients +jni = { version = "0.21.1" } -# Bech32 is used for the network aware addresses (some additional functionality is required which we -# 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" +# Used to allow for more powerful macros +paste = { version = "1.0.12" } +walkdir = "2.3.3" +indexmap = { version = "1.9.3", features = ["serde", "serde-1"] } [dev-dependencies] -lazy_static = { version = "1.4.0" } -serde_json = { version = "1.0.91" } +walkdir = "2.3.3" + +[lib] +crate-type = ["staticlib", "cdylib", "rlib"] -[features] -default = ["radix-engine"] -radix-engine = ["dep:radix-engine"] \ No newline at end of file +[profile.release] +incremental = false +panic = 'abort' +codegen-units = 1 diff --git a/radix-engine-toolkit/cbindgen.toml b/radix-engine-toolkit/cbindgen.toml new file mode 100644 index 00000000..885682a5 --- /dev/null +++ b/radix-engine-toolkit/cbindgen.toml @@ -0,0 +1,10 @@ +documentation = false + +[parse] +clean = true +parse_deps = true +include = ["radix-engine-toolkit-core"] +extra_bindings = ["radix-engine-toolkit-core"] + +[parse.expand] +crates = ["radix-engine-toolkit", "radix-engine-toolkit-core"] \ No newline at end of file diff --git a/radix-engine-toolkit/clippy.toml b/radix-engine-toolkit/clippy.toml new file mode 100644 index 00000000..912eb67b --- /dev/null +++ b/radix-engine-toolkit/clippy.toml @@ -0,0 +1,3 @@ +disallowed-types = [ + "std::collections::BTreeMap", +] \ No newline at end of file diff --git a/radix-engine-toolkit/rustfmt.toml b/radix-engine-toolkit/rustfmt.toml new file mode 100644 index 00000000..a735b984 --- /dev/null +++ b/radix-engine-toolkit/rustfmt.toml @@ -0,0 +1,3 @@ +unstable_features = true +wrap_comments = true +comment_width = 100 \ No newline at end of file diff --git a/radix-engine-toolkit/src/buffer.rs b/radix-engine-toolkit/src/buffer.rs deleted file mode 100644 index a2a6adec..00000000 --- a/radix-engine-toolkit/src/buffer.rs +++ /dev/null @@ -1,92 +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. - -//! This module contains a number of functions used for memory interactions. These functions provide -//! a way to allocate, deallocate, and read memory. - -use std::alloc::{alloc, dealloc, Layout}; - -/// A type alias of the main pointer type that this module uses. -pub type Pointer = *mut std::ffi::c_char; - -/// Allocates memory of the specified capacity and returns a pointer to that memory location. -/// -/// This function allocates memory based on the passed capacity and returns a pointer to that -/// memory location. This function does not make any assumptions on the data that will be stored -/// at that memory location. -/// -/// # Safety -/// -/// * This function makes use of pointers which is an unsafe feature. -/// * Memory allocated through this function should be deallocated through [`toolkit_free`] or any -/// function that calls [`toolkit_free`]. -/// -/// # Arguments -/// -/// * `capacity`: [`usize`] - The capacity (in bytes) to allocate in memory -/// -/// # Returns -/// -/// * [`Pointer`]: A pointer to the allocated memory location. -#[no_mangle] -pub unsafe extern "C" fn toolkit_alloc(capacity: usize) -> Pointer { - let align = std::mem::align_of::(); - let layout = Layout::from_size_align_unchecked(capacity, align); - alloc(layout) as Pointer -} - -/// Fees up memory of a specific `capacity` beginning from the specified `pointer` location. -/// -/// # Safety -/// -/// * This function makes use of pointers which is an unsafe feature. -/// * This function assumes that the memory was allocated through the [toolkit_alloc] function. -/// -/// # Arguments -/// -/// * `pointer`: [`Pointer`] - A pointer to the allocated memory location -/// * `capacity`: [`usize`] - The amount of memory to deallocate -#[no_mangle] -pub unsafe extern "C" fn toolkit_free(pointer: Pointer, capacity: usize) { - let align = std::mem::align_of::(); - let layout = Layout::from_size_align_unchecked(capacity, align); - dealloc(pointer as *mut _, layout); -} - -/// Fees up memory allocated for a c-string at `pointer` location. -/// -/// # Assumptions -/// -/// * This function assumes that the memory location contains a null-terminated C-String which has -/// been allocated and written to memory through functions provides in the [`crate::memory`] module. -/// -/// # Safety -/// -/// * This function makes use of pointers which is an unsafe feature. -/// * This function assumes that the memory was allocated through the [`toolkit_alloc`] function. -/// -/// # Arguments -/// -/// * `pointer`: [`Pointer`] - A pointer to the allocated memory location -#[no_mangle] -pub unsafe extern "C" fn toolkit_free_c_string(pointer: Pointer) { - // Loading the C-String from memory to get the byte-count of the string. - let length = std::ffi::CStr::from_ptr(pointer as *const std::ffi::c_char) - .to_bytes() - .len(); - toolkit_free(pointer, length); -} diff --git a/radix-engine-toolkit/src/error.rs b/radix-engine-toolkit/src/error.rs index 8282f588..408aedc3 100644 --- a/radix-engine-toolkit/src/error.rs +++ b/radix-engine-toolkit/src/error.rs @@ -15,255 +15,70 @@ // specific language governing permissions and limitations // under the License. -use std::fmt::Display; +use radix_engine_toolkit_core::functions::manifest_sbor::ManifestSborError; +use radix_engine_toolkit_core::functions::scrypto_sbor::ScryptoSborError; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; -use toolkit_derive::serializable; +use crate::{ + models::transaction::instructions::SerializableInstructionsError, utils::debug_string, +}; -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. -#[serializable] -#[serde(tag = "error")] +#[derive(Serialize, Deserialize, JsonSchema, Debug)] +#[serde(tag = "kind", content = "error")] pub enum Error { - // ====== - // Value - // ====== - /// An error emitted when the toolkit attempts to decode some string as a hex string and fails - FailedToDecodeHex { - message: String, - }, - - /// A generic error where an operation expected something to be of one length but it was found - /// to be of a different length - InvalidLength { - /// The length that the object was expected to be. - #[serde_as(as = "serde_with::DisplayFromStr")] - expected: usize, - - /// The length that the object was found to be. - #[serde_as(as = "serde_with::DisplayFromStr")] - found: usize, - }, - - /// Represents an address error encountered during the Bech32 encoding or decoding phase - AddressError { - message: String, - }, - - /// 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 `ManifestAstValueKind`s for a given request or operation (this - /// set forms an 'or' and not an 'and'). - expected: Vec, - - /// The `ManifestAstValueKind` that was found. - found: ManifestAstValueKind, - }, - - /// An error emitted when an invalid enum discriminator is encountered. This typically means - /// that an enum discriminator was given as a string but there was no known mapping from the - /// string to a `u8`. - InvalidEnumDiscriminator { - discriminator: String, - }, - - // ===== - // SBOR - // ===== - /// Represents an error when trying to encode some object in SBOR. - SborEncodeError { - message: String, - }, - - /// Represents an error when trying to decode some object in SBOR. - SborDecodeError { - 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 - // ==== - /// An error emitted when a value of an unexpected kind is encountered while parsing the AST. - /// As an example, a `Decimal` value is represented as a `Decimal("some number string")`. If - /// 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: ManifestAstValueKind, - expected: Vec, - found: ManifestAstValueKind, - }, - - /// An error emitted when the parsing of a value from string fails. - ParseError { - kind: ManifestAstValueKind, - message: String, - }, - - /// An error emitted when an invalid expression string is encountered. - InvalidExpressionString { - found: String, - excepted: Vec, - }, - - // ============ - // Manifest - // ============ - /// An error emitted when the transaction compilation fails - ManifestCompileError { - message: String, - }, - - /// An error emitted when the transaction decompilation fails - ManifestDecompileError { - message: String, - }, - - ManifestGenerationError { - message: String, - }, - - // =========== - // Validation - // =========== - /// An error emitted when there is a network mismatch between addresses and the header network - NetworkMismatchError { - found: u8, - expected: u8, - }, - - /// An error emitted when a byte array could not be interpreted through any of the intent - /// formats - UnrecognizedCompiledIntentFormat, - - /// An error emitted when an address of a unknown format is passed to the Radix Engine Toolkit - /// for processing. - UnrecognizedAddressFormat, - - /// An error emitted when the validation of the content of a Scrypto type fails. Currently, - /// this is emitted if the validation of non-fungible local ids fails. - ContentValidationError { - message: String, - }, - - // ========= - // Requests - // ========= - /// An error emitted when the contents of the request string pointer could not be loaded. - InvalidRequestString { - message: String, - }, - - /// An error emitted when an operation was meant to be infallible but has failed. This is used - /// as a replacement to panics to bubble whatever error to the caller. If you see this error, - /// please report it as you should never get to see it. - 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, + InvocationInterpretationError(InvocationInterpretationError), + InvocationHandlingError(InvocationHandlingError), +} - /// An error emitted when the passed address is not believed to be an Olympia address. - NotAnOlympiaAddress { - address: String, - }, +#[derive(Serialize, Deserialize, JsonSchema, Debug)] +#[serde(tag = "kind", content = "error")] +pub enum InvocationInterpretationError { + SerializationError(String), + DeserializationError(String), + Utf8Error(String), + FailedToAllocateJniString(String), + FailedToReadJniString(String), +} - /// Transaction was not committed. - TransactionNotCommitted, +#[derive(Serialize, Deserialize, JsonSchema, Debug)] +#[serde(tag = "kind", content = "error")] +pub enum InvocationHandlingError { + DerivationError(String), + SerializableInstructionsError(String), + EncodeError(String, String), + DecodeError(String, String), + InstructionVisitorError(String), + ManifestSborError(String), + ScryptoSborError(String), } -impl Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self) +impl From for Error { + fn from(value: InvocationHandlingError) -> Self { + Self::InvocationHandlingError(value) } } -macro_rules! to_debug_string { - ($expression: expr) => { - format!("{:?}", $expression) - }; +impl From for Error { + fn from(value: InvocationInterpretationError) -> Self { + Self::InvocationInterpretationError(value) + } } -macro_rules! generate_from_error { - ($error: ty as $variant: ident) => { - impl From<$error> for Error { - fn from(message: $error) -> Self { - Self::$variant { - message: to_debug_string!(message), - } - } - } - }; +impl From for InvocationHandlingError { + fn from(value: SerializableInstructionsError) -> Self { + Self::SerializableInstructionsError(debug_string(value)) + } } -generate_from_error!(hex::FromHexError as FailedToDecodeHex); -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); -generate_from_error!(native_transaction::manifest::DecompileError as ManifestDecompileError); -generate_from_error!(std::str::Utf8Error as InvalidRequestString); -generate_from_error!( - native_transaction::manifest::generator::GeneratorError as ManifestGenerationError -); -generate_from_error!(scrypto::runtime::ContentValidationError as ContentValidationError); - -macro_rules! impl_from_parse_error { - ($($error_type: ty => $kind: ident,)*) => { - $( - impl From<$error_type> for Error { - fn from(error: $error_type) -> Self { - Self::ParseError { - kind: ManifestAstValueKind::$kind, - message: format!("{:?}", error) - } - } - } - )* - }; +impl From for InvocationHandlingError { + fn from(value: ManifestSborError) -> Self { + Self::ManifestSborError(debug_string(value)) + } } -impl_from_parse_error! { - scrypto::prelude::ParseDecimalError => Decimal, - scrypto::prelude::ParsePreciseDecimalError => PreciseDecimal, - scrypto::prelude::ParseNonFungibleLocalIdError => NonFungibleLocalId, - scrypto::prelude::ParseNonFungibleGlobalIdError => NonFungibleGlobalId, - scrypto::prelude::ParseManifestBlobRefError => Blob, +impl From for InvocationHandlingError { + fn from(value: ScryptoSborError) -> Self { + Self::ScryptoSborError(debug_string(value)) + } } - -/// The result type used by the Radix Engine Toolkit where all errors are of a single type. -pub type Result = std::result::Result; diff --git a/radix-engine-toolkit/src/example/address/entity_address.rs b/radix-engine-toolkit/src/example/address/entity_address.rs deleted file mode 100644 index 598aa42a..00000000 --- a/radix-engine-toolkit/src/example/address/entity_address.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 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/non_fungible.rs b/radix-engine-toolkit/src/example/address/non_fungible.rs deleted file mode 100644 index c4e9b8e2..00000000 --- a/radix-engine-toolkit/src/example/address/non_fungible.rs +++ /dev/null @@ -1,86 +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::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 deleted file mode 100644 index 93b769b2..00000000 --- a/radix-engine-toolkit/src/example/crypto/mod.rs +++ /dev/null @@ -1,66 +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 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/instruction.rs b/radix-engine-toolkit/src/example/instruction.rs deleted file mode 100644 index 666e3401..00000000 --- a/radix-engine-toolkit/src/example/instruction.rs +++ /dev/null @@ -1,1270 +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 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/transaction/header.rs b/radix-engine-toolkit/src/example/transaction/header.rs deleted file mode 100644 index cd030677..00000000 --- a/radix-engine-toolkit/src/example/transaction/header.rs +++ /dev/null @@ -1,56 +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 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/transaction_structure.rs b/radix-engine-toolkit/src/example/transaction/transaction_structure.rs deleted file mode 100644 index 8ffa91c9..00000000 --- a/radix-engine-toolkit/src/example/transaction/transaction_structure.rs +++ /dev/null @@ -1,92 +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 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 deleted file mode 100644 index 79474762..00000000 --- a/radix-engine-toolkit/src/example/value/ast_value.rs +++ /dev/null @@ -1,376 +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 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 deleted file mode 100644 index a1a590bf..00000000 --- a/radix-engine-toolkit/src/example/value/manifest_sbor_value.rs +++ /dev/null @@ -1,251 +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 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/scrypto_sbor_value.rs b/radix-engine-toolkit/src/example/value/scrypto_sbor_value.rs deleted file mode 100644 index a7b9df84..00000000 --- a/radix-engine-toolkit/src/example/value/scrypto_sbor_value.rs +++ /dev/null @@ -1,255 +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 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/functions/derive.rs b/radix-engine-toolkit/src/functions/derive.rs new file mode 100644 index 00000000..704f478b --- /dev/null +++ b/radix-engine-toolkit/src/functions/derive.rs @@ -0,0 +1,339 @@ +// 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::prelude::*; +use radix_engine_common::prelude::PublicKey; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +//================================================ +// Derive Virtual Account Address from Public Key +//================================================ + +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub struct DeriveVirtualAccountAddressFromPublicKeyInput { + pub public_key: SerializablePublicKey, + pub network_id: SerializableU8, +} +pub type DeriveVirtualAccountAddressFromPublicKeyOutput = SerializableNodeId; + +pub struct DeriveVirtualAccountAddressFromPublicKey; +impl<'a> Function<'a> for DeriveVirtualAccountAddressFromPublicKey { + type Input = DeriveVirtualAccountAddressFromPublicKeyInput; + type Output = DeriveVirtualAccountAddressFromPublicKeyOutput; + + fn handle(input: Self::Input) -> Result { + let DeriveVirtualAccountAddressFromPublicKeyInput { + public_key, + network_id, + } = input; + + let virtual_account_address = + radix_engine_toolkit_core::functions::derive::virtual_account_address_from_public_key( + &public_key, + ); + + Ok(SerializableNodeId(SerializableNodeIdInternal { + network_id: *network_id, + node_id: virtual_account_address.into_node_id(), + })) + } +} + +export_function!( + DeriveVirtualAccountAddressFromPublicKey as derive_virtual_account_address_from_public_key +); +export_jni_function!( + DeriveVirtualAccountAddressFromPublicKey as deriveVirtualAccountAddressFromPublicKey +); + +//================================================= +// Derive Virtual Identity Address from Public Key +//================================================= + +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub struct DeriveVirtualIdentityAddressFromPublicKeyInput { + pub public_key: SerializablePublicKey, + pub network_id: SerializableU8, +} +pub type DeriveVirtualIdentityAddressFromPublicKeyOutput = SerializableNodeId; + +pub struct DeriveVirtualIdentityAddressFromPublicKey; +impl<'a> Function<'a> for DeriveVirtualIdentityAddressFromPublicKey { + type Input = DeriveVirtualIdentityAddressFromPublicKeyInput; + type Output = DeriveVirtualIdentityAddressFromPublicKeyOutput; + + fn handle(input: Self::Input) -> Result { + let DeriveVirtualIdentityAddressFromPublicKeyInput { + public_key, + network_id, + } = input; + + let virtual_identity_address = + radix_engine_toolkit_core::functions::derive::virtual_identity_address_from_public_key( + &public_key, + ); + + Ok(SerializableNodeId(SerializableNodeIdInternal { + network_id: *network_id, + node_id: virtual_identity_address.into_node_id(), + })) + } +} + +export_function!( + DeriveVirtualIdentityAddressFromPublicKey as derive_virtual_identity_address_from_public_key +); +export_jni_function!( + DeriveVirtualIdentityAddressFromPublicKey as deriveVirtualIdentityAddressFromPublicKey +); + +//================================================================= +// Derive Virtual Signature Non-Fungible Global Id from Public Key +//================================================================= + +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub struct DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKeyInput { + pub public_key: SerializablePublicKey, + pub network_id: SerializableU8, +} +pub type DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKeyOutput = + SerializableNonFungibleGlobalId; + +pub struct DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKey; +impl<'a> Function<'a> for DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKey { + type Input = DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKeyInput; + type Output = DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKeyOutput; + + fn handle(input: Self::Input) -> Result { + let DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKeyInput { + public_key, + network_id, + } = input; + + let non_fungible_global_id = + radix_engine_toolkit_core::functions::derive::virtual_signature_non_fungible_global_id_from_public_key( + &PublicKey::from(public_key), + ); + + Ok(SerializableNonFungibleGlobalId( + SerializableNonFungibleGlobalIdInternal { + network_id: *network_id, + non_fungible_global_id, + }, + )) + } +} + +export_function!( + DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKey + as derive_virtual_signature_non_fungible_global_id_from_public_key +); +export_jni_function!( + DeriveVirtualSignatureNonFungibleGlobalIdFromPublicKey + as deriveVirtualSignatureNonFungibleGlobalIdFromPublicKey +); + +//============================================================= +// Derive Virtual Account Address from Olympia Account Address +//============================================================= + +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub struct DeriveVirtualAccountAddressFromOlympiaAccountAddressInput { + pub olympia_account_address: String, + pub network_id: SerializableU8, +} +pub type DeriveVirtualAccountAddressFromOlympiaAccountAddressOutput = SerializableNodeId; + +pub struct DeriveVirtualAccountAddressFromOlympiaAccountAddress; +impl<'a> Function<'a> for DeriveVirtualAccountAddressFromOlympiaAccountAddress { + type Input = DeriveVirtualAccountAddressFromOlympiaAccountAddressInput; + type Output = DeriveVirtualAccountAddressFromOlympiaAccountAddressOutput; + + fn handle(input: Self::Input) -> Result { + let DeriveVirtualAccountAddressFromOlympiaAccountAddressInput { + olympia_account_address, + network_id, + } = input; + + let component_address = + radix_engine_toolkit_core::functions::derive::virtual_account_address_from_olympia_account_address( + olympia_account_address, + ).map_err(|error| InvocationHandlingError::DerivationError(debug_string(error)))?; + + Ok(SerializableNodeId(SerializableNodeIdInternal { + network_id: *network_id, + node_id: component_address.into_node_id(), + })) + } +} + +export_function!( + DeriveVirtualAccountAddressFromOlympiaAccountAddress + as derive_virtual_account_address_from_olympia_account_address +); +export_jni_function!( + DeriveVirtualAccountAddressFromOlympiaAccountAddress + as deriveVirtualAccountAddressFromOlympiaAccountAddress +); + +//======================================================= +// Derive Resource Address from Olympia Resource Address +//======================================================= + +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub struct DeriveResourceAddressFromOlympiaResourceAddressInput { + pub olympia_resource_address: String, + pub network_id: SerializableU8, +} +pub type DeriveResourceAddressFromOlympiaResourceAddressOutput = SerializableNodeId; + +pub struct DeriveResourceAddressFromOlympiaResourceAddress; +impl<'a> Function<'a> for DeriveResourceAddressFromOlympiaResourceAddress { + type Input = DeriveResourceAddressFromOlympiaResourceAddressInput; + type Output = DeriveResourceAddressFromOlympiaResourceAddressOutput; + + fn handle(input: Self::Input) -> Result { + let DeriveResourceAddressFromOlympiaResourceAddressInput { + olympia_resource_address, + network_id, + } = input; + + let component_address = + radix_engine_toolkit_core::functions::derive::resource_address_from_olympia_resource_address( + olympia_resource_address, + ).map_err(|error| InvocationHandlingError::DerivationError(debug_string(error)))?; + + Ok(SerializableNodeId(SerializableNodeIdInternal { + network_id: *network_id, + node_id: component_address.into_node_id(), + })) + } +} + +export_function!( + DeriveResourceAddressFromOlympiaResourceAddress + as derive_resource_address_from_olympia_resource_address +); +export_jni_function!( + DeriveResourceAddressFromOlympiaResourceAddress + as deriveResourceAddressFromOlympiaResourceAddress +); + +//================================================ +// Derive Public Key from Olympia Account Address +//================================================ + +pub type DerivePublicKeyFromOlympiaAccountAddressInput = String; +pub type DerivePublicKeyFromOlympiaAccountAddressOutput = SerializableSecp256k1PublicKey; + +pub struct DerivePublicKeyFromOlympiaAccountAddress; +impl<'a> Function<'a> for DerivePublicKeyFromOlympiaAccountAddress { + type Input = DerivePublicKeyFromOlympiaAccountAddressInput; + type Output = DerivePublicKeyFromOlympiaAccountAddressOutput; + + fn handle(input: Self::Input) -> Result { + let public_key = + radix_engine_toolkit_core::functions::derive::public_key_from_olympia_account_address( + input, + ) + .map_err(|error| InvocationHandlingError::DerivationError(debug_string(error)))?; + + Ok(public_key.into()) + } +} + +export_function!( + DerivePublicKeyFromOlympiaAccountAddress as derive_public_key_from_olympia_account_address +); +export_jni_function!( + DerivePublicKeyFromOlympiaAccountAddress as derivePublicKeyFromOlympiaAccountAddress +); + +//================================================ +// Derive Olympia Account from Public Key Address +//================================================ + +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub struct DeriveOlympiaAccountAddressFromPublicKeyInput { + pub olympia_network: SerializableOlympiaNetwork, + pub public_key: SerializableSecp256k1PublicKey, +} +pub type DeriveOlympiaAccountAddressFromPublicKeyOutput = String; + +pub struct DeriveOlympiaAccountAddressFromPublicKey; +impl<'a> Function<'a> for DeriveOlympiaAccountAddressFromPublicKey { + type Input = DeriveOlympiaAccountAddressFromPublicKeyInput; + type Output = DeriveOlympiaAccountAddressFromPublicKeyOutput; + + fn handle(input: Self::Input) -> Result { + let DeriveOlympiaAccountAddressFromPublicKeyInput { + olympia_network, + public_key, + } = input; + + let olympia_account_address = + radix_engine_toolkit_core::functions::derive::olympia_account_address_from_public_key( + &public_key.into(), + olympia_network.into(), + ); + + Ok(olympia_account_address) + } +} + +export_function!( + DeriveOlympiaAccountAddressFromPublicKey as derive_olympia_account_address_from_public_key +); +export_jni_function!( + DeriveOlympiaAccountAddressFromPublicKey as deriveOlympiaAccountAddressFromPublicKey +); + +//============================================= +// Derive Node Address from Public Key Address +//============================================= + +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub struct DeriveNodeAddressFromPublicKeyInput { + pub network_id: SerializableU8, + pub public_key: SerializableSecp256k1PublicKey, +} +pub type DeriveNodeAddressFromPublicKeyOutput = String; + +pub struct DeriveNodeAddressFromPublicKey; +impl<'a> Function<'a> for DeriveNodeAddressFromPublicKey { + type Input = DeriveNodeAddressFromPublicKeyInput; + type Output = DeriveNodeAddressFromPublicKeyOutput; + + fn handle(input: Self::Input) -> Result { + let DeriveNodeAddressFromPublicKeyInput { + network_id, + public_key, + } = input; + + let node_address = + radix_engine_toolkit_core::functions::derive::node_address_from_public_key( + &public_key.into(), + *network_id, + ); + + Ok(node_address) + } +} + +export_function!(DeriveNodeAddressFromPublicKey as derive_node_address_from_public_key); +export_jni_function!(DeriveNodeAddressFromPublicKey as deriveNodeAddressFromPublicKey); diff --git a/radix-engine-toolkit/src/functions/execution.rs b/radix-engine-toolkit/src/functions/execution.rs new file mode 100644 index 00000000..e61ffcc5 --- /dev/null +++ b/radix-engine-toolkit/src/functions/execution.rs @@ -0,0 +1,493 @@ +// 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::prelude::*; + +use radix_engine::system::system_modules::execution_trace::*; +use radix_engine::transaction::*; +use radix_engine_common::prelude::*; +use radix_engine_toolkit_core::functions::execution::*; +use radix_engine_toolkit_core::instruction_visitor::visitors::transaction_type::transfer_visitor::*; +use radix_engine_toolkit_core::instruction_visitor::visitors::transaction_type::general_transaction_visitor::*; +use schemars::*; +use scrypto::api::node_modules::metadata::*; +use serde::*; + +//=================== +// Execution Analyze +//=================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct ExecutionAnalyzeInput { + pub instructions: SerializableInstructions, + pub network_id: SerializableU8, + pub preview_receipt: SerializableBytes, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct ExecutionAnalyzeOutput { + pub fee_locks: SerializableFeeLocks, + pub fee_summary: SerializableFeeSummary, + pub transaction_type: SerializableTransactionType, +} + +pub struct ExecutionAnalyze; +impl<'f> Function<'f> for ExecutionAnalyze { + type Input = ExecutionAnalyzeInput; + type Output = ExecutionAnalyzeOutput; + + fn handle( + ExecutionAnalyzeInput { + instructions, + network_id, + preview_receipt, + }: Self::Input, + ) -> Result { + let instructions = instructions.to_instructions(*network_id)?; + let receipt = scrypto_decode::(&preview_receipt).map_err(|error| { + InvocationHandlingError::DecodeError(debug_string(error), debug_string(preview_receipt)) + })?; + + let execution_analysis = + radix_engine_toolkit_core::functions::execution::analyze(&instructions, &receipt) + .map_err(|error| { + InvocationHandlingError::InstructionVisitorError(debug_string(error)) + })?; + + let transaction_type = match execution_analysis.transaction_type { + TransactionType::NonConforming => SerializableTransactionType::NonConforming, + TransactionType::SimpleTransfer(simple_transfer) => { + SerializableTransactionType::SimpleTransfer(Box::new( + SerializableSimpleTransferTransactionType { + from: SerializableNodeId::new( + simple_transfer.from.into_node_id(), + *network_id, + ), + to: SerializableNodeId::new(simple_transfer.to.into_node_id(), *network_id), + transferred: SerializableResourceSpecifier::new( + simple_transfer.transferred, + *network_id, + ), + }, + )) + } + TransactionType::Transfer(transfer) => SerializableTransactionType::Transfer(Box::new( + SerializableTransferTransactionType { + from: SerializableNodeId::new(transfer.from.into_node_id(), *network_id), + transfers: transfer + .transfers + .into_iter() + .map(|(key, value)| { + ( + SerializableNodeId::new(key.into_node_id(), *network_id), + value + .into_iter() + .map(|(key, value)| { + ( + SerializableNodeId::new( + key.into_node_id(), + *network_id, + ), + value.into(), + ) + }) + .collect(), + ) + }) + .collect(), + }, + )), + TransactionType::GeneralTransaction(general_transaction) => { + SerializableTransactionType::GeneralTransaction(Box::new( + SerializableGeneralTransactionType { + account_proofs: general_transaction + .account_proofs + .into_iter() + .map(|address| { + SerializableNodeId::new(address.into_node_id(), *network_id) + }) + .collect(), + account_withdraws: general_transaction + .account_withdraws + .into_iter() + .map(|(key, value)| { + ( + SerializableNodeId::new(key.into_node_id(), *network_id), + value + .into_iter() + .map(|value| { + SerializableResourceSpecifier::new(value, *network_id) + }) + .collect(), + ) + }) + .collect(), + account_deposits: general_transaction + .account_deposits + .into_iter() + .map(|(key, value)| { + ( + SerializableNodeId::new(key.into_node_id(), *network_id), + value + .into_iter() + .map(|value| match value { + Source::Guaranteed(value) => { + SerializableSource::Guaranteed { + value: SerializableResourceSpecifier::new( + value, + *network_id, + ), + } + } + Source::Predicted(instruction_index, value) => { + SerializableSource::Predicted { + instruction_index: (instruction_index as u64) + .into(), + value: SerializableResourceSpecifier::new( + value, + *network_id, + ), + } + } + }) + .collect(), + ) + }) + .collect(), + addresses_in_manifest: InstructionsExtractAddressesOutput { + addresses: transform_addresses_set_to_map( + general_transaction.addresses_in_manifest.0, + *network_id, + ), + named_addresses: array_into!( + general_transaction.addresses_in_manifest.1 + ), + }, + metadata_of_newly_created_entities: general_transaction + .metadata_of_newly_created_entities + .into_iter() + .map(|(key, value)| { + ( + SerializableNodeId::new(key.into_node_id(), *network_id), + value + .into_iter() + .map(|(key, value)| { + ( + key, + SerializableMetadataValue::new(value, *network_id), + ) + }) + .collect(), + ) + }) + .collect(), + data_of_newly_minted_non_fungibles: general_transaction + .data_of_newly_minted_non_fungibles + .into_iter() + .map(|(key, value)| { + ( + SerializableNodeId::new(key.into_node_id(), *network_id), + value + .into_iter() + .map(|(key, value)| { + (key.into(), scrypto_encode(&value).unwrap().into()) + }) + .collect(), + ) + }) + .collect(), + }, + )) + } + }; + + let fee_summary = execution_analysis.fee_summary.into(); + let fee_locks = execution_analysis.fee_locks.into(); + + Ok(Self::Output { + fee_locks, + fee_summary, + transaction_type, + }) + } +} + +export_function!(ExecutionAnalyze as execution_analyze); +export_jni_function!(ExecutionAnalyze as executionAnalyze); + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind", content = "value")] +pub enum SerializableTransactionType { + SimpleTransfer(Box), + Transfer(Box), + GeneralTransaction(Box), + NonConforming, +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct SerializableFeeSummary { + pub network_fee: SerializableDecimal, + pub royalty_fee: SerializableDecimal, +} + +impl From for SerializableFeeSummary { + fn from(value: FeeSummary) -> Self { + Self { + network_fee: value.network_fee.into(), + royalty_fee: value.royalty_fee.into(), + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct SerializableFeeLocks { + pub lock: SerializableDecimal, + pub contingent_lock: SerializableDecimal, +} + +impl From for SerializableFeeLocks { + fn from(value: radix_engine_toolkit_core::functions::execution::FeeLocks) -> Self { + Self { + lock: value.lock.into(), + contingent_lock: value.contingent_lock.into(), + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(tag = "kind")] +pub enum SerializableResourceSpecifier { + Amount { + resource_address: SerializableNodeId, + amount: SerializableDecimal, + }, + Ids { + resource_address: SerializableNodeId, + ids: HashSet, + }, +} + +impl SerializableResourceSpecifier { + pub fn new(resource_specifier: ResourceSpecifier, network_id: u8) -> Self { + match resource_specifier { + ResourceSpecifier::Amount(resource_address, amount) => Self::Amount { + resource_address: SerializableNodeId::new( + resource_address.into_node_id(), + network_id, + ), + amount: amount.into(), + }, + ResourceSpecifier::Ids(resource_address, ids) => Self::Ids { + resource_address: SerializableNodeId::new( + resource_address.into_node_id(), + network_id, + ), + ids: ids.into_iter().map(Into::into).collect(), + }, + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(tag = "kind", content = "value")] +pub enum SerializableResources { + Amount(SerializableDecimal), + Ids(HashSet), +} + +impl From for SerializableResources { + fn from(value: Resources) -> Self { + match value { + Resources::Amount(amount) => Self::Amount(amount.into()), + Resources::Ids(ids) => Self::Ids(ids.into_iter().map(Into::into).collect()), + } + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct SerializableSimpleTransferTransactionType { + pub from: SerializableNodeId, + pub to: SerializableNodeId, + pub transferred: SerializableResourceSpecifier, +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct SerializableTransferTransactionType { + pub from: SerializableNodeId, + pub transfers: HashMap>, +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct SerializableGeneralTransactionType { + pub account_proofs: HashSet, + pub account_withdraws: HashMap>, + pub account_deposits: + HashMap>>, + pub addresses_in_manifest: InstructionsExtractAddressesOutput, + pub metadata_of_newly_created_entities: + HashMap>, + pub data_of_newly_minted_non_fungibles: + HashMap>, +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(tag = "kind", content = "value")] +pub enum SerializableMetadataValue { + String(String), + Bool(bool), + U8(SerializableU8), + U32(SerializableU32), + U64(SerializableU64), + I32(SerializableI32), + I64(SerializableI64), + Decimal(SerializableDecimal), + GlobalAddress(SerializableNodeId), + PublicKey(SerializablePublicKey), + NonFungibleGlobalId(SerializableNonFungibleGlobalId), + NonFungibleLocalId(SerializableNonFungibleLocalId), + Instant(SerializableI64), + Url(String), + Origin(String), + PublicKeyHash(SerializablePublicKeyHash), + + StringArray(Vec), + BoolArray(Vec), + U8Array(Vec), + U32Array(Vec), + U64Array(Vec), + I32Array(Vec), + I64Array(Vec), + DecimalArray(Vec), + GlobalAddressArray(Vec), + PublicKeyArray(Vec), + NonFungibleGlobalIdArray(Vec), + NonFungibleLocalIdArray(Vec), + InstantArray(Vec), + UrlArray(Vec), + OriginArray(Vec), + PublicKeyHashArray(Vec), +} + +impl SerializableMetadataValue { + pub fn new(metadata: MetadataValue, network_id: u8) -> Self { + match metadata { + MetadataValue::String(value) => SerializableMetadataValue::String(value), + MetadataValue::Bool(value) => SerializableMetadataValue::Bool(value), + MetadataValue::U8(value) => SerializableMetadataValue::U8(value.into()), + MetadataValue::U32(value) => SerializableMetadataValue::U32(value.into()), + MetadataValue::U64(value) => SerializableMetadataValue::U64(value.into()), + MetadataValue::I32(value) => SerializableMetadataValue::I32(value.into()), + MetadataValue::I64(value) => SerializableMetadataValue::I64(value.into()), + MetadataValue::Decimal(value) => SerializableMetadataValue::Decimal(value.into()), + MetadataValue::GlobalAddress(value) => SerializableMetadataValue::GlobalAddress( + SerializableNodeId::new(value.into_node_id(), network_id), + ), + MetadataValue::PublicKey(value) => SerializableMetadataValue::PublicKey(value.into()), + MetadataValue::NonFungibleGlobalId(value) => { + SerializableMetadataValue::NonFungibleGlobalId( + SerializableNonFungibleGlobalId::new(value, network_id), + ) + } + MetadataValue::NonFungibleLocalId(value) => { + SerializableMetadataValue::NonFungibleLocalId(value.into()) + } + MetadataValue::Instant(value) => { + SerializableMetadataValue::Instant(value.seconds_since_unix_epoch.into()) + } + MetadataValue::Url(value) => SerializableMetadataValue::Url(value.0), + MetadataValue::Origin(value) => SerializableMetadataValue::Origin(value.0), + MetadataValue::PublicKeyHash(value) => { + SerializableMetadataValue::PublicKeyHash(value.into()) + } + + MetadataValue::StringArray(value) => SerializableMetadataValue::StringArray(value), + MetadataValue::BoolArray(value) => SerializableMetadataValue::BoolArray(value), + MetadataValue::U8Array(value) => SerializableMetadataValue::U8Array(array_into!(value)), + MetadataValue::U32Array(value) => { + SerializableMetadataValue::U32Array(array_into!(value)) + } + MetadataValue::U64Array(value) => { + SerializableMetadataValue::U64Array(array_into!(value)) + } + MetadataValue::I32Array(value) => { + SerializableMetadataValue::I32Array(array_into!(value)) + } + MetadataValue::I64Array(value) => { + SerializableMetadataValue::I64Array(array_into!(value)) + } + MetadataValue::DecimalArray(value) => { + SerializableMetadataValue::DecimalArray(array_into!(value)) + } + MetadataValue::GlobalAddressArray(value) => { + SerializableMetadataValue::GlobalAddressArray( + value + .into_iter() + .map(|address| SerializableNodeId::new(address.into_node_id(), network_id)) + .collect(), + ) + } + MetadataValue::PublicKeyArray(value) => { + SerializableMetadataValue::PublicKeyArray(array_into!(value)) + } + MetadataValue::NonFungibleGlobalIdArray(value) => { + SerializableMetadataValue::NonFungibleGlobalIdArray( + value + .into_iter() + .map(|id| SerializableNonFungibleGlobalId::new(id, network_id)) + .collect(), + ) + } + MetadataValue::NonFungibleLocalIdArray(value) => { + SerializableMetadataValue::NonFungibleLocalIdArray(array_into!(value)) + } + MetadataValue::InstantArray(value) => SerializableMetadataValue::InstantArray( + value + .into_iter() + .map(|id| id.seconds_since_unix_epoch.into()) + .collect(), + ), + MetadataValue::UrlArray(value) => SerializableMetadataValue::UrlArray( + value.into_iter().map(|value| value.0).collect(), + ), + MetadataValue::OriginArray(value) => SerializableMetadataValue::OriginArray( + value.into_iter().map(|value| value.0).collect(), + ), + MetadataValue::PublicKeyHashArray(value) => { + SerializableMetadataValue::PublicKeyHashArray(array_into!(value)) + } + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(tag = "kind")] +pub enum SerializableSource { + Guaranteed { + value: T, + }, + Predicted { + value: T, + instruction_index: SerializableU64, + }, +} + +macro_rules! array_into { + ($array: expr) => { + $array.into_iter().map(Into::into).collect() + }; +} +use array_into; diff --git a/radix-engine-toolkit/src/functions/handler.rs b/radix-engine-toolkit/src/functions/handler.rs new file mode 100644 index 00000000..c720cac3 --- /dev/null +++ b/radix-engine-toolkit/src/functions/handler.rs @@ -0,0 +1,64 @@ +// 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::traits::Function; +use crate::memory::Pointer; +use crate::utils::{serialize_and_write_to_memory, serialize_to_jstring}; + +pub fn handle_invocation<'f, F>(input: Pointer) -> Pointer +where + F: Function<'f>, +{ + let result = crate::utils::read_and_deserialize_from_memory::(input) + .map_err(crate::error::Error::from) + .and_then(|input| F::handle(input).map_err(crate::error::Error::from)) + .and_then(|output| { + serialize_and_write_to_memory::(&output).map_err(crate::error::Error::from) + }) + .map_err(|error| { + serialize_and_write_to_memory::(&error).expect("can't fail") + }); + + match result { + Ok(ptr) => ptr, + Err(ptr) => ptr, + } +} + +pub fn handle_jni_invocation<'f, F>( + mut env: jni::JNIEnv, + _: jni::objects::JClass, + input: jni::objects::JString, +) -> jni::sys::jstring +where + F: Function<'f>, +{ + let result = crate::utils::deserialize_from_jstring::(&mut env, &input) + .map_err(crate::error::Error::from) + .and_then(|input| F::handle(input).map_err(crate::error::Error::from)) + .and_then(|output| { + serialize_to_jstring::(&env, &output).map_err(crate::error::Error::from) + }) + .map_err(|error| { + serialize_to_jstring::(&env, &error).expect("can't fail") + }); + + match result { + Ok(ptr) => ptr, + Err(ptr) => ptr, + } +} diff --git a/radix-engine-toolkit/src/functions/information.rs b/radix-engine-toolkit/src/functions/information.rs new file mode 100644 index 00000000..b9cbb00c --- /dev/null +++ b/radix-engine-toolkit/src/functions/information.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 super::macros::{export_function, export_jni_function}; +use super::traits::Function; +use radix_engine_toolkit_core::functions::information::DependencyInformation; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub struct BuildInformationInput {} + +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub struct BuildInformationOutput { + pub version: String, + pub scrypto_dependency: SerializableDependencyInformation, +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +#[serde(tag = "kind", content = "value")] +pub enum SerializableDependencyInformation { + Version(String), + Tag(String), + Branch(String), + Rev(String), +} + +pub struct BuildInformation; +impl<'a> Function<'a> for BuildInformation { + type Input = BuildInformationInput; + type Output = BuildInformationOutput; + + fn handle(_: Self::Input) -> Result { + let build_information = radix_engine_toolkit_core::functions::information::information(); + Ok(BuildInformationOutput { + version: build_information.version, + scrypto_dependency: match build_information.scrypto_dependency { + DependencyInformation::Branch(string) => { + SerializableDependencyInformation::Branch(string) + } + DependencyInformation::Tag(string) => { + SerializableDependencyInformation::Tag(string) + } + DependencyInformation::Version(string) => { + SerializableDependencyInformation::Version(string) + } + DependencyInformation::Rev(string) => { + SerializableDependencyInformation::Rev(string) + } + }, + }) + } +} + +export_function!(BuildInformation as build_information); +export_jni_function!(BuildInformation as buildInformation); diff --git a/radix-engine-toolkit/src/functions/instructions.rs b/radix-engine-toolkit/src/functions/instructions.rs new file mode 100644 index 00000000..b79c9f98 --- /dev/null +++ b/radix-engine-toolkit/src/functions/instructions.rs @@ -0,0 +1,400 @@ +// 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::prelude::*; + +use radix_engine_common::types::EntityType; +use sbor::prelude::{HashMap, HashSet}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +//=================== +// Instructions Hash +//=================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct InstructionsHashInput { + pub instructions: SerializableInstructions, + pub network_id: SerializableU8, +} +pub type InstructionsHashOutput = SerializableHash; + +pub struct InstructionsHash; +impl<'a> Function<'a> for InstructionsHash { + type Input = InstructionsHashInput; + type Output = InstructionsHashOutput; + + fn handle( + InstructionsHashInput { + instructions, + network_id, + }: Self::Input, + ) -> Result { + let instructions = instructions.to_instructions(*network_id)?; + + let hash = radix_engine_toolkit_core::functions::instructions::hash(&instructions) + .map_err(|error| { + InvocationHandlingError::EncodeError( + debug_string(error), + debug_string(instructions), + ) + })?; + + Ok(hash.into()) + } +} + +export_function!(InstructionsHash as instructions_hash); +export_jni_function!(InstructionsHash as instructionsHash); + +//====================== +// Instructions Convert +//====================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct InstructionsConvertInput { + pub instructions: SerializableInstructions, + pub network_id: SerializableU8, + pub instructions_kind: SerializableInstructionsKind, +} +pub type InstructionsConvertOutput = SerializableInstructions; + +pub struct InstructionsConvert; +impl<'a> Function<'a> for InstructionsConvert { + type Input = InstructionsConvertInput; + type Output = InstructionsConvertOutput; + + fn handle( + Self::Input { + mut instructions, + network_id, + instructions_kind, + }: Self::Input, + ) -> Result { + instructions.convert_serializable_instructions_kind(instructions_kind, *network_id)?; + Ok(instructions) + } +} + +export_function!(InstructionsConvert as instructions_convert); +export_jni_function!(InstructionsConvert as instructionsConvert); + +//====================== +// Instructions Compile +//====================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct InstructionsCompileInput { + pub instructions: SerializableInstructions, + pub network_id: SerializableU8, +} +pub type InstructionsCompileOutput = SerializableBytes; + +pub struct InstructionsCompile; +impl<'a> Function<'a> for InstructionsCompile { + type Input = InstructionsCompileInput; + type Output = InstructionsCompileOutput; + + fn handle( + InstructionsCompileInput { + instructions, + network_id, + }: Self::Input, + ) -> Result { + let instructions = instructions.to_instructions(*network_id)?; + + let compiled = radix_engine_toolkit_core::functions::instructions::compile(&instructions) + .map_err(|error| { + InvocationHandlingError::EncodeError(debug_string(error), debug_string(instructions)) + })?; + + Ok(compiled.into()) + } +} + +export_function!(InstructionsCompile as instructions_compile); +export_jni_function!(InstructionsCompile as instructionsCompile); + +//======================== +// Instructions Decompile +//======================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct InstructionsDecompileInput { + pub compiled: SerializableBytes, + pub network_id: SerializableU8, + pub instructions_kind: SerializableInstructionsKind, +} +pub type InstructionsDecompileOutput = SerializableInstructions; + +pub struct InstructionsDecompile; +impl<'a> Function<'a> for InstructionsDecompile { + type Input = InstructionsDecompileInput; + type Output = InstructionsDecompileOutput; + + fn handle( + InstructionsDecompileInput { + compiled, + network_id, + instructions_kind, + }: Self::Input, + ) -> Result { + let instructions = radix_engine_toolkit_core::functions::instructions::decompile( + &**compiled, + ) + .map_err(|error| { + InvocationHandlingError::EncodeError(debug_string(error), debug_string(compiled)) + })?; + + let instructions = + SerializableInstructions::new(&instructions, instructions_kind, *network_id)?; + + Ok(instructions) + } +} + +export_function!(InstructionsDecompile as instructions_decompile); +export_jni_function!(InstructionsDecompile as instructionsDecompile); + +//================================== +// Instructions Statically Validate +//================================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct InstructionsStaticallyValidateInput { + pub instructions: SerializableInstructions, + pub network_id: SerializableU8, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind", content = "value")] +pub enum InstructionsStaticallyValidateOutput { + Valid, + Invalid(String), +} + +pub struct InstructionsStaticallyValidate; +impl<'a> Function<'a> for InstructionsStaticallyValidate { + type Input = InstructionsStaticallyValidateInput; + type Output = InstructionsStaticallyValidateOutput; + + fn handle( + InstructionsStaticallyValidateInput { + instructions, + network_id, + }: Self::Input, + ) -> Result { + let instructions = instructions.to_instructions(*network_id)?; + + match radix_engine_toolkit_core::functions::instructions::statically_validate(&instructions) + { + Ok(..) => Ok(Self::Output::Valid), + Err(error) => Ok(Self::Output::Invalid(debug_string(error))), + } + } +} + +export_function!(InstructionsStaticallyValidate as instructions_statically_validate); +export_jni_function!(InstructionsStaticallyValidate as instructionsStaticallyValidate); + +//================================ +// Instructions Extract Addresses +//================================ + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct InstructionsExtractAddressesInput { + pub instructions: SerializableInstructions, + pub network_id: SerializableU8, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct InstructionsExtractAddressesOutput { + pub addresses: HashMap>, + pub named_addresses: HashSet, +} + +pub struct InstructionsExtractAddresses; +impl<'a> Function<'a> for InstructionsExtractAddresses { + type Input = InstructionsExtractAddressesInput; + type Output = InstructionsExtractAddressesOutput; + + fn handle( + InstructionsExtractAddressesInput { + instructions, + network_id, + }: Self::Input, + ) -> Result { + let instructions = instructions.to_instructions(*network_id)?; + + let (addresses, named_addresses) = + radix_engine_toolkit_core::functions::instructions::extract_addresses(&instructions); + + let addresses = transform_addresses_set_to_map(addresses, *network_id); + + Ok(Self::Output { + addresses, + named_addresses: named_addresses.into_iter().map(Into::into).collect(), + }) + } +} + +export_function!(InstructionsExtractAddresses as instructions_extract_addresses); +export_jni_function!(InstructionsExtractAddresses as instructionsExtractAddresses); + +#[derive( + Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, JsonSchema, +)] +pub enum SerializableEntityType { + GlobalPackage, + GlobalConsensusManager, + GlobalValidator, + GlobalTransactionTracker, + GlobalGenericComponent, + GlobalAccount, + GlobalIdentity, + GlobalAccessController, + GlobalOneResourcePool, + GlobalTwoResourcePool, + GlobalMultiResourcePool, + GlobalVirtualSecp256k1Account, + GlobalVirtualSecp256k1Identity, + GlobalVirtualEd25519Account, + GlobalVirtualEd25519Identity, + GlobalFungibleResourceManager, + InternalFungibleVault, + GlobalNonFungibleResourceManager, + InternalNonFungibleVault, + InternalGenericComponent, + InternalAccount, + InternalKeyValueStore, +} + +impl SerializableEntityType { + pub fn all() -> Vec { + vec![ + Self::GlobalPackage, + Self::GlobalConsensusManager, + Self::GlobalValidator, + Self::GlobalTransactionTracker, + Self::GlobalGenericComponent, + Self::GlobalAccount, + Self::GlobalIdentity, + Self::GlobalAccessController, + Self::GlobalOneResourcePool, + Self::GlobalTwoResourcePool, + Self::GlobalMultiResourcePool, + Self::GlobalVirtualSecp256k1Account, + Self::GlobalVirtualSecp256k1Identity, + Self::GlobalVirtualEd25519Account, + Self::GlobalVirtualEd25519Identity, + Self::GlobalFungibleResourceManager, + Self::InternalFungibleVault, + Self::GlobalNonFungibleResourceManager, + Self::InternalNonFungibleVault, + Self::InternalGenericComponent, + Self::InternalAccount, + Self::InternalKeyValueStore, + ] + } +} + +impl From for SerializableEntityType { + fn from(value: EntityType) -> Self { + match value { + EntityType::GlobalPackage => Self::GlobalPackage, + EntityType::GlobalConsensusManager => Self::GlobalConsensusManager, + EntityType::GlobalValidator => Self::GlobalValidator, + EntityType::GlobalTransactionTracker => Self::GlobalTransactionTracker, + EntityType::GlobalGenericComponent => Self::GlobalGenericComponent, + EntityType::GlobalAccount => Self::GlobalAccount, + EntityType::GlobalIdentity => Self::GlobalIdentity, + EntityType::GlobalAccessController => Self::GlobalAccessController, + EntityType::GlobalOneResourcePool => Self::GlobalOneResourcePool, + EntityType::GlobalTwoResourcePool => Self::GlobalTwoResourcePool, + EntityType::GlobalMultiResourcePool => Self::GlobalMultiResourcePool, + EntityType::GlobalVirtualSecp256k1Account => Self::GlobalVirtualSecp256k1Account, + EntityType::GlobalVirtualSecp256k1Identity => Self::GlobalVirtualSecp256k1Identity, + EntityType::GlobalVirtualEd25519Account => Self::GlobalVirtualEd25519Account, + EntityType::GlobalVirtualEd25519Identity => Self::GlobalVirtualEd25519Identity, + EntityType::GlobalFungibleResourceManager => Self::GlobalFungibleResourceManager, + EntityType::InternalFungibleVault => Self::InternalFungibleVault, + EntityType::GlobalNonFungibleResourceManager => Self::GlobalNonFungibleResourceManager, + EntityType::InternalNonFungibleVault => Self::InternalNonFungibleVault, + EntityType::InternalGenericComponent => Self::InternalGenericComponent, + EntityType::InternalAccount => Self::InternalAccount, + EntityType::InternalKeyValueStore => Self::InternalKeyValueStore, + } + } +} + +impl From for EntityType { + fn from(value: SerializableEntityType) -> Self { + match value { + SerializableEntityType::GlobalPackage => Self::GlobalPackage, + SerializableEntityType::GlobalConsensusManager => Self::GlobalConsensusManager, + SerializableEntityType::GlobalValidator => Self::GlobalValidator, + SerializableEntityType::GlobalTransactionTracker => Self::GlobalTransactionTracker, + SerializableEntityType::GlobalGenericComponent => Self::GlobalGenericComponent, + SerializableEntityType::GlobalAccount => Self::GlobalAccount, + SerializableEntityType::GlobalIdentity => Self::GlobalIdentity, + SerializableEntityType::GlobalAccessController => Self::GlobalAccessController, + SerializableEntityType::GlobalOneResourcePool => Self::GlobalOneResourcePool, + SerializableEntityType::GlobalTwoResourcePool => Self::GlobalTwoResourcePool, + SerializableEntityType::GlobalMultiResourcePool => Self::GlobalMultiResourcePool, + SerializableEntityType::GlobalVirtualSecp256k1Account => { + Self::GlobalVirtualSecp256k1Account + } + SerializableEntityType::GlobalVirtualSecp256k1Identity => { + Self::GlobalVirtualSecp256k1Identity + } + SerializableEntityType::GlobalVirtualEd25519Account => { + Self::GlobalVirtualEd25519Account + } + SerializableEntityType::GlobalVirtualEd25519Identity => { + Self::GlobalVirtualEd25519Identity + } + SerializableEntityType::GlobalFungibleResourceManager => { + Self::GlobalFungibleResourceManager + } + SerializableEntityType::InternalFungibleVault => Self::InternalFungibleVault, + SerializableEntityType::GlobalNonFungibleResourceManager => { + Self::GlobalNonFungibleResourceManager + } + SerializableEntityType::InternalNonFungibleVault => Self::InternalNonFungibleVault, + SerializableEntityType::InternalGenericComponent => Self::InternalGenericComponent, + SerializableEntityType::InternalAccount => Self::InternalAccount, + SerializableEntityType::InternalKeyValueStore => Self::InternalKeyValueStore, + } + } +} + +pub(crate) fn transform_addresses_set_to_map( + addresses: HashSet, + network_id: u8, +) -> HashMap> { + let mut addresses_map = HashMap::>::new(); + for node_id in addresses.into_iter() { + addresses_map + .entry(node_id.entity_type().unwrap().into()) + .or_default() + .push(SerializableNodeId::new(node_id, network_id)) + } + for entity_type in SerializableEntityType::all() { + addresses_map.entry(entity_type).or_default(); + } + addresses_map +} diff --git a/radix-engine-toolkit/src/functions/intent.rs b/radix-engine-toolkit/src/functions/intent.rs new file mode 100644 index 00000000..6d6b165f --- /dev/null +++ b/radix-engine-toolkit/src/functions/intent.rs @@ -0,0 +1,153 @@ +// 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 schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::prelude::*; + +//============= +// Intent Hash +//============= + +pub type IntentHashInput = SerializableIntent; +pub type IntentHashOutput = SerializableHash; + +pub struct IntentHash; +impl<'f> Function<'f> for IntentHash { + type Input = IntentHashInput; + type Output = IntentHashOutput; + + fn handle(intent: Self::Input) -> Result { + let intent = intent.to_native(*intent.header.network_id)?; + let hash = + radix_engine_toolkit_core::functions::intent::hash(&intent).map_err(|error| { + InvocationHandlingError::EncodeError(debug_string(error), debug_string(intent)) + })?; + Ok(hash.into()) + } +} + +export_function!(IntentHash as intent_hash); +export_jni_function!(IntentHash as intentHash); + +//================ +// Intent Compile +//================ + +pub type IntentCompileInput = SerializableIntent; +pub type IntentCompileOutput = SerializableBytes; + +pub struct IntentCompile; +impl<'f> Function<'f> for IntentCompile { + type Input = IntentCompileInput; + type Output = IntentCompileOutput; + + fn handle(intent: Self::Input) -> Result { + let intent = intent.to_native(*intent.header.network_id)?; + let compile = + radix_engine_toolkit_core::functions::intent::compile(&intent).map_err(|error| { + InvocationHandlingError::EncodeError(debug_string(error), debug_string(intent)) + })?; + Ok(compile.into()) + } +} + +export_function!(IntentCompile as intent_compile); +export_jni_function!(IntentCompile as intentCompile); + +//================== +// Intent Decompile +//================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct IntentDecompileInput { + pub compiled: SerializableBytes, + pub instructions_kind: SerializableInstructionsKind, +} +pub type IntentDecompileOutput = SerializableIntent; + +pub struct IntentDecompile; +impl<'a> Function<'a> for IntentDecompile { + type Input = IntentDecompileInput; + type Output = IntentDecompileOutput; + + fn handle( + IntentDecompileInput { + compiled, + instructions_kind, + }: Self::Input, + ) -> Result { + let intent = radix_engine_toolkit_core::functions::intent::decompile(&**compiled).map_err( + |error| { + InvocationHandlingError::EncodeError(debug_string(error), debug_string(compiled)) + }, + )?; + + let intent = + SerializableIntent::from_native(&intent, intent.header.network_id, instructions_kind)?; + + Ok(intent) + } +} + +export_function!(IntentDecompile as intent_decompile); +export_jni_function!(IntentDecompile as intentDecompile); + +//============================ +// Intent Statically Validate +//============================ + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct IntentStaticallyValidateInput { + pub intent: SerializableIntent, + pub validation_config: SerializableValidationConfig, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind", content = "value")] +pub enum IntentStaticallyValidateOutput { + Valid, + Invalid(String), +} + +pub struct IntentStaticallyValidate; +impl<'a> Function<'a> for IntentStaticallyValidate { + type Input = IntentStaticallyValidateInput; + type Output = IntentStaticallyValidateOutput; + + fn handle( + IntentStaticallyValidateInput { + intent, + validation_config, + }: Self::Input, + ) -> Result { + let intent = intent.to_native(*intent.header.network_id)?; + let validation_config = validation_config.into(); + + match radix_engine_toolkit_core::functions::intent::statically_validate( + &intent, + validation_config, + ) { + Ok(..) => Ok(Self::Output::Valid), + Err(error) => Ok(Self::Output::Invalid(debug_string(error))), + } + } +} + +export_function!(IntentStaticallyValidate as intent_statically_validate); +export_jni_function!(IntentStaticallyValidate as intentStaticallyValidate); diff --git a/radix-engine-toolkit/src/functions/macros.rs b/radix-engine-toolkit/src/functions/macros.rs new file mode 100644 index 00000000..2bf08b49 --- /dev/null +++ b/radix-engine-toolkit/src/functions/macros.rs @@ -0,0 +1,42 @@ +// 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_rules! export_function { + ($function: ident as $name: ident) => { + #[no_mangle] + pub extern "C" fn $name(ptr: $crate::memory::Pointer) -> $crate::memory::Pointer { + crate::functions::handler::handle_invocation::<$function>(ptr) + } + }; +} + +macro_rules! export_jni_function { + ($function: ident as $name: ident) => { + paste::paste! { + #[no_mangle] + pub extern "system" fn [< Java_com_radixdlt_toolkit_RadixEngineToolkitFFI_ $name >]( + env: jni::JNIEnv, + class: jni::objects::JClass, + input: jni::objects::JString, + ) -> jni::sys::jstring { + crate::functions::handler::handle_jni_invocation::<$function>(env, class, input) + } + } + }; +} + +pub(crate) use {export_function, export_jni_function}; diff --git a/radix-engine-toolkit/src/functions/manifest.rs b/radix-engine-toolkit/src/functions/manifest.rs new file mode 100644 index 00000000..7db227dc --- /dev/null +++ b/radix-engine-toolkit/src/functions/manifest.rs @@ -0,0 +1,172 @@ +// 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 schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::prelude::*; + +//=============== +// Manifest Hash +//=============== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct ManifestHashInput { + pub manifest: SerializableTransactionManifest, + pub network_id: SerializableU8, +} +pub type ManifestHashOutput = SerializableHash; + +pub struct ManifestHash; +impl<'f> Function<'f> for ManifestHash { + type Input = ManifestHashInput; + type Output = ManifestHashOutput; + + fn handle( + ManifestHashInput { + manifest, + network_id, + }: Self::Input, + ) -> Result { + let manifest = manifest.to_native(*network_id)?; + let hash = + radix_engine_toolkit_core::functions::manifest::hash(&manifest).map_err(|error| { + InvocationHandlingError::EncodeError(debug_string(error), debug_string(manifest)) + })?; + Ok(hash.into()) + } +} + +export_function!(ManifestHash as manifest_hash); +export_jni_function!(ManifestHash as manifestHash); + +//================== +// Manifest Compile +//================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct ManifestCompileInput { + pub manifest: SerializableTransactionManifest, + pub network_id: SerializableU8, +} +pub type ManifestCompileOutput = SerializableBytes; + +pub struct ManifestCompile; +impl<'f> Function<'f> for ManifestCompile { + type Input = ManifestCompileInput; + type Output = ManifestCompileOutput; + + fn handle( + ManifestCompileInput { + manifest, + network_id, + }: Self::Input, + ) -> Result { + let manifest = manifest.to_native(*network_id)?; + let compile = radix_engine_toolkit_core::functions::manifest::compile(&manifest).map_err( + |error| { + InvocationHandlingError::EncodeError(debug_string(error), debug_string(manifest)) + }, + )?; + Ok(compile.into()) + } +} + +export_function!(ManifestCompile as manifest_compile); +export_jni_function!(ManifestCompile as manifestCompile); + +//==================== +// Manifest Decompile +//==================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct ManifestDecompileInput { + pub compiled: SerializableBytes, + pub network_id: SerializableU8, + pub instructions_kind: SerializableInstructionsKind, +} +pub type ManifestDecompileOutput = SerializableTransactionManifest; + +pub struct ManifestDecompile; +impl<'a> Function<'a> for ManifestDecompile { + type Input = ManifestDecompileInput; + type Output = ManifestDecompileOutput; + + fn handle( + ManifestDecompileInput { + compiled, + network_id, + instructions_kind, + }: Self::Input, + ) -> Result { + let manifest = radix_engine_toolkit_core::functions::manifest::decompile(&**compiled) + .map_err(|error| { + InvocationHandlingError::EncodeError(debug_string(error), debug_string(compiled)) + })?; + + let manifest = SerializableTransactionManifest::from_native( + &manifest, + *network_id, + instructions_kind, + )?; + + Ok(manifest) + } +} + +export_function!(ManifestDecompile as manifest_decompile); +export_jni_function!(ManifestDecompile as manifestDecompile); + +//============================== +// Manifest Statically Validate +//============================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct ManifestStaticallyValidateInput { + pub manifest: SerializableTransactionManifest, + pub network_id: SerializableU8, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind", content = "value")] +pub enum ManifestStaticallyValidateOutput { + Valid, + Invalid(String), +} + +pub struct ManifestStaticallyValidate; +impl<'a> Function<'a> for ManifestStaticallyValidate { + type Input = ManifestStaticallyValidateInput; + type Output = ManifestStaticallyValidateOutput; + + fn handle( + ManifestStaticallyValidateInput { + manifest, + network_id, + }: Self::Input, + ) -> Result { + let manifest = manifest.to_native(*network_id)?; + + match radix_engine_toolkit_core::functions::manifest::statically_validate(&manifest) { + Ok(..) => Ok(Self::Output::Valid), + Err(error) => Ok(Self::Output::Invalid(debug_string(error))), + } + } +} + +export_function!(ManifestStaticallyValidate as manifest_statically_validate); +export_jni_function!(ManifestStaticallyValidate as manifestStaticallyValidate); diff --git a/radix-engine-toolkit/src/functions/manifest_sbor.rs b/radix-engine-toolkit/src/functions/manifest_sbor.rs new file mode 100644 index 00000000..bfe46497 --- /dev/null +++ b/radix-engine-toolkit/src/functions/manifest_sbor.rs @@ -0,0 +1,98 @@ +// 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::ops::Deref; + +use crate::prelude::*; + +use radix_engine_common::prelude::*; +use radix_engine_toolkit_core::functions::manifest_sbor::*; +use radix_engine_toolkit_core::utils::*; +use sbor::{LocalTypeIndex, Schema}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +//================================ +// Manifest Sbor Decode to String +//================================ + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct ManifestSborDecodeToStringInput { + encoded_payload: SerializableBytes, + representation: SerializableManifestSborStringRepresentation, + network_id: SerializableU8, + schema: Option<(SerializableLocalTypeIndex, SerializableBytes)>, +} +pub type ManifestSborDecodeToStringOutput = String; + +pub struct ManifestSborDecodeToString; +impl<'f> Function<'f> for ManifestSborDecodeToString { + type Input = ManifestSborDecodeToStringInput; + type Output = ManifestSborDecodeToStringOutput; + + fn handle( + ManifestSborDecodeToStringInput { + encoded_payload, + network_id, + representation, + schema, + }: Self::Input, + ) -> Result { + let encoded_payload = encoded_payload.deref().clone(); + let network_id = *network_id; + let representation = match representation { + SerializableManifestSborStringRepresentation::ManifestString => { + ManifestSborStringRepresentation::ManifestString + } + SerializableManifestSborStringRepresentation::Json(mode) => { + ManifestSborStringRepresentation::JSON(mode.into()) + } + }; + let schema = if let Some((local_type_index, schema)) = schema { + let local_type_index = LocalTypeIndex::from(local_type_index); + let schema = + scrypto_decode::>(&schema).map_err(|error| { + InvocationHandlingError::DecodeError(debug_string(error), debug_string(schema)) + })?; + + Some((local_type_index, schema)) + } else { + None + }; + let network_definition = network_definition_from_network_id(network_id); + let bech32_encoder = AddressBech32Encoder::new(&network_definition); + + let string = + radix_engine_toolkit_core::functions::manifest_sbor::decode_to_string_representation( + encoded_payload, + representation, + &bech32_encoder, + schema, + )?; + + Ok(string) + } +} + +export_function!(ManifestSborDecodeToString as manifest_sbor_decode_to_string); +export_jni_function!(ManifestSborDecodeToString as manifestSborDecodeToString); + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub enum SerializableManifestSborStringRepresentation { + ManifestString, + Json(SerializableSerializationMode), +} diff --git a/radix-engine-toolkit/src/model/transaction/mod.rs b/radix-engine-toolkit/src/functions/mod.rs similarity index 76% rename from radix-engine-toolkit/src/model/transaction/mod.rs rename to radix-engine-toolkit/src/functions/mod.rs index 379cc18f..ddb00e68 100644 --- a/radix-engine-toolkit/src/model/transaction/mod.rs +++ b/radix-engine-toolkit/src/functions/mod.rs @@ -15,18 +15,17 @@ // specific language governing permissions and limitations // under the License. -pub mod header; -pub mod instruction_list; +pub mod derive; +pub mod execution; +pub mod handler; +pub mod information; +pub mod instructions; pub mod intent; +pub mod macros; pub mod manifest; -pub mod notarized_intent; +pub mod manifest_sbor; +pub mod notarized_transaction; +pub mod scrypto_sbor; pub mod signed_intent; -pub mod validation_config; - -pub use header::*; -pub use instruction_list::*; -pub use intent::*; -pub use manifest::*; -pub use notarized_intent::*; -pub use signed_intent::*; -pub use validation_config::*; +pub mod traits; +pub mod utils; diff --git a/radix-engine-toolkit/src/functions/notarized_transaction.rs b/radix-engine-toolkit/src/functions/notarized_transaction.rs new file mode 100644 index 00000000..d05263ac --- /dev/null +++ b/radix-engine-toolkit/src/functions/notarized_transaction.rs @@ -0,0 +1,180 @@ +// 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 schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::prelude::*; + +//============================ +// Notarized Transaction Hash +//============================ + +pub type NotarizedTransactionHashInput = SerializableNotarizedTransaction; +pub type NotarizedTransactionHashOutput = SerializableHash; + +pub struct NotarizedTransactionHash; +impl<'f> Function<'f> for NotarizedTransactionHash { + type Input = NotarizedTransactionHashInput; + type Output = NotarizedTransactionHashOutput; + + fn handle( + notarized_transaction: Self::Input, + ) -> Result { + let notarized_transaction = notarized_transaction + .to_native(*notarized_transaction.signed_intent.intent.header.network_id)?; + let hash = radix_engine_toolkit_core::functions::notarized_transaction::hash( + ¬arized_transaction, + ) + .map_err(|error| { + InvocationHandlingError::EncodeError( + debug_string(error), + debug_string(notarized_transaction), + ) + })?; + Ok(hash.into()) + } +} + +export_function!(NotarizedTransactionHash as notarized_transaction_hash); +export_jni_function!(NotarizedTransactionHash as notarizedTransactionHash); + +//=============================== +// Notarized Transaction Compile +//=============================== + +pub type NotarizedTransactionCompileInput = SerializableNotarizedTransaction; +pub type NotarizedTransactionCompileOutput = SerializableBytes; + +pub struct NotarizedTransactionCompile; +impl<'f> Function<'f> for NotarizedTransactionCompile { + type Input = NotarizedTransactionCompileInput; + type Output = NotarizedTransactionCompileOutput; + + fn handle( + notarized_transaction: Self::Input, + ) -> Result { + let notarized_transaction = notarized_transaction + .to_native(*notarized_transaction.signed_intent.intent.header.network_id)?; + let compile = radix_engine_toolkit_core::functions::notarized_transaction::compile( + ¬arized_transaction, + ) + .map_err(|error| { + InvocationHandlingError::EncodeError( + debug_string(error), + debug_string(notarized_transaction), + ) + })?; + Ok(compile.into()) + } +} + +export_function!(NotarizedTransactionCompile as notarized_transaction_compile); +export_jni_function!(NotarizedTransactionCompile as notarizedTransactionCompile); + +//================================= +// Notarized Transaction Decompile +//================================= + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct NotarizedTransactionDecompileInput { + pub compiled: SerializableBytes, + pub instructions_kind: SerializableInstructionsKind, +} +pub type NotarizedTransactionDecompileOutput = SerializableNotarizedTransaction; + +pub struct NotarizedTransactionDecompile; +impl<'a> Function<'a> for NotarizedTransactionDecompile { + type Input = NotarizedTransactionDecompileInput; + type Output = NotarizedTransactionDecompileOutput; + + fn handle( + NotarizedTransactionDecompileInput { + compiled, + instructions_kind, + }: Self::Input, + ) -> Result { + let notarized_transaction = + radix_engine_toolkit_core::functions::notarized_transaction::decompile(&**compiled) + .map_err(|error| { + InvocationHandlingError::EncodeError( + debug_string(error), + debug_string(compiled), + ) + })?; + + let notarized_transaction = SerializableNotarizedTransaction::from_native( + ¬arized_transaction, + notarized_transaction.signed_intent.intent.header.network_id, + instructions_kind, + )?; + + Ok(notarized_transaction) + } +} + +export_function!(NotarizedTransactionDecompile as notarized_transaction_decompile); +export_jni_function!(NotarizedTransactionDecompile as notarizedTransactionDecompile); + +//=========================================== +// Notarized Transaction Statically Validate +//=========================================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct NotarizedTransactionStaticallyValidateInput { + pub notarized_transaction: SerializableNotarizedTransaction, + pub validation_config: SerializableValidationConfig, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind", content = "value")] +pub enum NotarizedTransactionStaticallyValidateOutput { + Valid, + Invalid(String), +} + +pub struct NotarizedTransactionStaticallyValidate; +impl<'a> Function<'a> for NotarizedTransactionStaticallyValidate { + type Input = NotarizedTransactionStaticallyValidateInput; + type Output = NotarizedTransactionStaticallyValidateOutput; + + fn handle( + NotarizedTransactionStaticallyValidateInput { + notarized_transaction, + validation_config, + }: Self::Input, + ) -> Result { + let notarized_transaction = notarized_transaction + .to_native(*notarized_transaction.signed_intent.intent.header.network_id)?; + let validation_config = validation_config.into(); + + match radix_engine_toolkit_core::functions::notarized_transaction::statically_validate( + ¬arized_transaction, + validation_config, + ) { + Ok(..) => Ok(Self::Output::Valid), + Err(error) => Ok(Self::Output::Invalid(debug_string(error))), + } + } +} + +export_function!( + NotarizedTransactionStaticallyValidate as notarized_transaction_statically_validate +); +export_jni_function!( + NotarizedTransactionStaticallyValidate as notarizedTransactionStaticallyValidate +); diff --git a/radix-engine-toolkit/src/functions/scrypto_sbor.rs b/radix-engine-toolkit/src/functions/scrypto_sbor.rs new file mode 100644 index 00000000..78f2b329 --- /dev/null +++ b/radix-engine-toolkit/src/functions/scrypto_sbor.rs @@ -0,0 +1,84 @@ +// 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::ops::Deref; + +use crate::prelude::*; + +use radix_engine_common::prelude::*; +use radix_engine_toolkit_core::utils::*; +use sbor::{LocalTypeIndex, Schema}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +//=============================== +// Scrypto Sbor Decode to String +//=============================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct ScryptoSborDecodeToStringInput { + encoded_payload: SerializableBytes, + representation: SerializableSerializationMode, + network_id: SerializableU8, + schema: Option<(SerializableLocalTypeIndex, SerializableBytes)>, +} +pub type ScryptoSborDecodeToStringOutput = String; + +pub struct ScryptoSborDecodeToString; +impl<'f> Function<'f> for ScryptoSborDecodeToString { + type Input = ScryptoSborDecodeToStringInput; + type Output = ScryptoSborDecodeToStringOutput; + + fn handle( + ScryptoSborDecodeToStringInput { + encoded_payload, + network_id, + representation, + schema, + }: Self::Input, + ) -> Result { + let encoded_payload = encoded_payload.deref().clone(); + let network_id = *network_id; + let representation = representation.into(); + let schema = if let Some((local_type_index, schema)) = schema { + let local_type_index = LocalTypeIndex::from(local_type_index); + let schema = + scrypto_decode::>(&schema).map_err(|error| { + InvocationHandlingError::DecodeError(debug_string(error), debug_string(schema)) + })?; + + Some((local_type_index, schema)) + } else { + None + }; + let network_definition = network_definition_from_network_id(network_id); + let bech32_encoder = AddressBech32Encoder::new(&network_definition); + + let string = + radix_engine_toolkit_core::functions::scrypto_sbor::decode_to_string_representation( + encoded_payload, + representation, + &bech32_encoder, + schema, + )?; + + Ok(string) + } +} + +export_function!(ScryptoSborDecodeToString as scrypto_sbor_decode_to_string); +export_jni_function!(ScryptoSborDecodeToString as scryptoSborDecodeToString); diff --git a/radix-engine-toolkit/src/functions/signed_intent.rs b/radix-engine-toolkit/src/functions/signed_intent.rs new file mode 100644 index 00000000..ec57f218 --- /dev/null +++ b/radix-engine-toolkit/src/functions/signed_intent.rs @@ -0,0 +1,167 @@ +// 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 schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +use crate::prelude::*; + +//==================== +// Signed Intent Hash +//==================== + +pub type SignedIntentHashInput = SerializableSignedIntent; +pub type SignedIntentHashOutput = SerializableHash; + +pub struct SignedIntentHash; +impl<'f> Function<'f> for SignedIntentHash { + type Input = SignedIntentHashInput; + type Output = SignedIntentHashOutput; + + fn handle( + signed_intent: Self::Input, + ) -> Result { + let signed_intent = signed_intent.to_native(*signed_intent.intent.header.network_id)?; + let hash = radix_engine_toolkit_core::functions::signed_intent::hash(&signed_intent) + .map_err(|error| { + InvocationHandlingError::EncodeError( + debug_string(error), + debug_string(signed_intent), + ) + })?; + Ok(hash.into()) + } +} + +export_function!(SignedIntentHash as signed_intent_hash); +export_jni_function!(SignedIntentHash as signedIntentHash); + +//======================= +// Signed Intent Compile +//======================= + +pub type SignedIntentCompileInput = SerializableSignedIntent; +pub type SignedIntentCompileOutput = SerializableBytes; + +pub struct SignedIntentCompile; +impl<'f> Function<'f> for SignedIntentCompile { + type Input = SignedIntentCompileInput; + type Output = SignedIntentCompileOutput; + + fn handle( + signed_intent: Self::Input, + ) -> Result { + let signed_intent = signed_intent.to_native(*signed_intent.intent.header.network_id)?; + let compile = radix_engine_toolkit_core::functions::signed_intent::compile(&signed_intent) + .map_err(|error| { + InvocationHandlingError::EncodeError( + debug_string(error), + debug_string(signed_intent), + ) + })?; + Ok(compile.into()) + } +} + +export_function!(SignedIntentCompile as signed_intent_compile); +export_jni_function!(SignedIntentCompile as signedIntentCompile); + +//========================= +// Signed Intent Decompile +//========================= + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SignedIntentDecompileInput { + pub compiled: SerializableBytes, + pub instructions_kind: SerializableInstructionsKind, +} +pub type SignedIntentDecompileOutput = SerializableSignedIntent; + +pub struct SignedIntentDecompile; +impl<'a> Function<'a> for SignedIntentDecompile { + type Input = SignedIntentDecompileInput; + type Output = SignedIntentDecompileOutput; + + fn handle( + SignedIntentDecompileInput { + compiled, + instructions_kind, + }: Self::Input, + ) -> Result { + let signed_intent = radix_engine_toolkit_core::functions::signed_intent::decompile( + &**compiled, + ) + .map_err(|error| { + InvocationHandlingError::EncodeError(debug_string(error), debug_string(compiled)) + })?; + + let signed_intent = SerializableSignedIntent::from_native( + &signed_intent, + signed_intent.intent.header.network_id, + instructions_kind, + )?; + + Ok(signed_intent) + } +} + +export_function!(SignedIntentDecompile as signed_intent_decompile); +export_jni_function!(SignedIntentDecompile as signedIntentDecompile); + +//=================================== +// Signed Intent Statically Validate +//=================================== + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SignedIntentStaticallyValidateInput { + pub signed_intent: SerializableSignedIntent, + pub validation_config: SerializableValidationConfig, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind", content = "value")] +pub enum SignedIntentStaticallyValidateOutput { + Valid, + Invalid(String), +} + +pub struct SignedIntentStaticallyValidate; +impl<'a> Function<'a> for SignedIntentStaticallyValidate { + type Input = SignedIntentStaticallyValidateInput; + type Output = SignedIntentStaticallyValidateOutput; + + fn handle( + SignedIntentStaticallyValidateInput { + signed_intent, + validation_config, + }: Self::Input, + ) -> Result { + let signed_intent = signed_intent.to_native(*signed_intent.intent.header.network_id)?; + let validation_config = validation_config.into(); + + match radix_engine_toolkit_core::functions::signed_intent::statically_validate( + &signed_intent, + validation_config, + ) { + Ok(..) => Ok(Self::Output::Valid), + Err(error) => Ok(Self::Output::Invalid(debug_string(error))), + } + } +} + +export_function!(SignedIntentStaticallyValidate as signed_intent_statically_validate); +export_jni_function!(SignedIntentStaticallyValidate as signedIntentStaticallyValidate); diff --git a/radix-engine-toolkit/src/functions/traits.rs b/radix-engine-toolkit/src/functions/traits.rs new file mode 100644 index 00000000..1a7108a6 --- /dev/null +++ b/radix-engine-toolkit/src/functions/traits.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 schemars::JsonSchema; +use serde::{de::DeserializeOwned, Deserialize, Serialize}; + +pub trait Function<'a> { + type Input: Serialize + Deserialize<'a> + DeserializeOwned + JsonSchema; + type Output: Serialize + Deserialize<'a> + DeserializeOwned + JsonSchema; + + fn handle(input: Self::Input) -> Result; +} diff --git a/radix-engine-toolkit/src/functions/utils.rs b/radix-engine-toolkit/src/functions/utils.rs new file mode 100644 index 00000000..2fe50e38 --- /dev/null +++ b/radix-engine-toolkit/src/functions/utils.rs @@ -0,0 +1,141 @@ +// 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::prelude::*; +use schemars::JsonSchema; +use scrypto::prelude::*; +use serde::{Deserialize, Serialize}; + +pub type UtilsKnownAddressesInput = SerializableU8; +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct UtilsKnownAddressesOutput { + pub resource_addresses: ResourceAddresses, + pub package_addresses: PackageAddresses, + pub component_addresses: ComponentAddresses, +} + +pub struct UtilsKnownAddress; +impl<'f> Function<'f> for UtilsKnownAddress { + type Input = UtilsKnownAddressesInput; + type Output = UtilsKnownAddressesOutput; + + fn handle(input: Self::Input) -> Result { + let network_id = *input; + + let resource_addresses = construct_addresses! { + ResourceAddresses, + network_id, + [ + xrd, + secp256k1_signature_virtual_badge, + ed25519_signature_virtual_badge, + package_of_direct_caller_virtual_badge, + global_caller_virtual_badge, + system_transaction_badge, + package_owner_badge, + validator_owner_badge, + account_owner_badge, + identity_owner_badge, + ] + }; + let package_addresses = construct_addresses! { + PackageAddresses, + network_id, + [ + package_package, + resource_package, + account_package, + identity_package, + consensus_manager_package, + access_controller_package, + pool_package, + transaction_processor_package, + metadata_module_package, + royalty_module_package, + access_rules_module_package, + genesis_helper_package, + faucet_package, + ] + }; + let component_addresses = construct_addresses! { + ComponentAddresses, + network_id, + [ + consensus_manager, + genesis_helper, + faucet, + ] + }; + + Ok(Self::Output { + component_addresses, + package_addresses, + resource_addresses, + }) + } +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct ResourceAddresses { + pub xrd: SerializableNodeId, + pub secp256k1_signature_virtual_badge: SerializableNodeId, + pub ed25519_signature_virtual_badge: SerializableNodeId, + pub package_of_direct_caller_virtual_badge: SerializableNodeId, + pub global_caller_virtual_badge: SerializableNodeId, + pub system_transaction_badge: SerializableNodeId, + pub package_owner_badge: SerializableNodeId, + pub validator_owner_badge: SerializableNodeId, + pub account_owner_badge: SerializableNodeId, + pub identity_owner_badge: SerializableNodeId, +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct PackageAddresses { + pub package_package: SerializableNodeId, + pub resource_package: SerializableNodeId, + pub account_package: SerializableNodeId, + pub identity_package: SerializableNodeId, + pub consensus_manager_package: SerializableNodeId, + pub access_controller_package: SerializableNodeId, + pub pool_package: SerializableNodeId, + pub transaction_processor_package: SerializableNodeId, + pub metadata_module_package: SerializableNodeId, + pub royalty_module_package: SerializableNodeId, + pub access_rules_module_package: SerializableNodeId, + pub genesis_helper_package: SerializableNodeId, + pub faucet_package: SerializableNodeId, +} + +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] +pub struct ComponentAddresses { + pub consensus_manager: SerializableNodeId, + pub genesis_helper: SerializableNodeId, + pub faucet: SerializableNodeId, +} + +macro_rules! construct_addresses { + ($struct_ident: expr, $network_id: expr, [$($field: ident),* $(,)?]) => { + paste::paste! { + $struct_ident { + $( + $field: SerializableNodeId::from_global_address([< $field:upper >], $network_id), + )* + } + } + }; +} +use construct_addresses; diff --git a/radix-engine-toolkit/src/lib.rs b/radix-engine-toolkit/src/lib.rs index 3571073c..b5fbbc20 100644 --- a/radix-engine-toolkit/src/lib.rs +++ b/radix-engine-toolkit/src/lib.rs @@ -15,11 +15,13 @@ // specific language governing permissions and limitations // under the License. -pub mod buffer; +/// cbindgen:ignore pub mod error; -pub mod example; -pub mod model; -pub mod request; -pub mod traits; +pub mod functions; +pub mod memory; +/// cbindgen:ignore +pub mod models; +/// cbindgen:ignore +pub mod prelude; +/// cbindgen:ignore pub mod utils; -pub mod visitor; diff --git a/radix-engine-toolkit/src/memory.rs b/radix-engine-toolkit/src/memory.rs new file mode 100644 index 00000000..2052162d --- /dev/null +++ b/radix-engine-toolkit/src/memory.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. + +#![allow(clippy::missing_safety_doc)] + +use std::alloc::{alloc, dealloc, Layout}; + +pub type Pointer = *mut std::ffi::c_char; + +#[no_mangle] +pub unsafe extern "C" fn toolkit_alloc(capacity: usize) -> Pointer { + let align = std::mem::align_of::(); + let layout = Layout::from_size_align_unchecked(capacity, align); + alloc(layout) as Pointer +} + +#[no_mangle] +pub unsafe extern "C" fn toolkit_free(pointer: Pointer, capacity: usize) { + let align = std::mem::align_of::(); + let layout = Layout::from_size_align_unchecked(capacity, align); + dealloc(pointer as *mut _, layout); +} + +#[no_mangle] +pub unsafe extern "C" fn toolkit_free_c_string(pointer: Pointer) { + // Loading the C-String from memory to get the byte-count of the string. + let length = std::ffi::CStr::from_ptr(pointer as *const std::ffi::c_char) + .to_bytes() + .len(); + toolkit_free(pointer, length); +} diff --git a/radix-engine-toolkit/src/model/address/coder.rs b/radix-engine-toolkit/src/model/address/coder.rs deleted file mode 100644 index 17c99cd7..00000000 --- a/radix-engine-toolkit/src/model/address/coder.rs +++ /dev/null @@ -1,156 +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 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 scrypto::address::{Bech32Decoder, Bech32Encoder}; -use scrypto::network::NetworkDefinition; -use scrypto::prelude::{ComponentAddress, PackageAddress, ResourceAddress}; - -/// A Bech32m encoder and decoder used in the Radix Engine Toolkit for all of it's address encoding -/// and decoding needs -pub struct Bech32Coder { - network_definition: NetworkDefinition, - encoder: Bech32Encoder, - decoder: Bech32Decoder, -} - -impl Bech32Coder { - pub fn new(network_id: u8) -> Self { - let network_definition = network_definition_from_network_id(network_id); - Self::new_with_network_definition(network_definition) - } - - pub fn new_with_network_definition(network_definition: NetworkDefinition) -> Self { - Self { - encoder: Bech32Encoder::new(&network_definition), - decoder: Bech32Decoder::new(&network_definition), - network_definition, - } - } - - pub fn encoder(&self) -> &Bech32Encoder { - &self.encoder - } - - pub fn decoder(&self) -> &Bech32Decoder { - &self.decoder - } - - pub fn network_definition(&self) -> &NetworkDefinition { - &self.network_definition - } - - pub fn network_id(&self) -> u8 { - self.network_definition.id - } - - pub fn new_from_hrp>(hrp: S) -> Result { - network_id_from_hrp(hrp).map(Self::new) - } - - pub fn new_from_address>(address: S) -> Result { - network_id_from_address_string(address).map(Self::new) - } - - pub fn encode_component_address>( - &self, - component_address: &A, - ) -> String { - self.encoder - .encode_component_address_to_string(component_address.borrow()) - } - - pub fn encode_resource_address>( - &self, - resource_address: A, - ) -> String { - self.encoder - .encode_resource_address_to_string(resource_address.borrow()) - } - - pub fn encode_package_address>(&self, package_address: A) -> String { - self.encoder - .encode_package_address_to_string(package_address.borrow()) - } - - pub fn decode_component_address>( - &self, - component_address: S, - ) -> Result { - self.decoder - .validate_and_decode_component_address(component_address.as_ref()) - .map_err(Error::from) - } - - pub fn decode_resource_address>( - &self, - resource_address: S, - ) -> Result { - self.decoder - .validate_and_decode_resource_address(resource_address.as_ref()) - .map_err(Error::from) - } - - pub fn decode_package_address>( - &self, - package_address: S, - ) -> Result { - self.decoder - .validate_and_decode_package_address(package_address.as_ref()) - .map_err(Error::from) - } - - pub fn decode_to_network_aware_component_address>( - &self, - component_address: S, - ) -> Result { - self.decode_component_address(component_address) - .map(|component_address| NetworkAwareComponentAddress { - network_id: self.network_id(), - address: component_address, - }) - } - - pub fn decode_to_network_aware_resource_address>( - &self, - resource_address: S, - ) -> Result { - self.decode_resource_address(resource_address) - .map(|resource_address| NetworkAwareResourceAddress { - network_id: self.network_id(), - address: resource_address, - }) - } - - pub fn decode_to_network_aware_package_address>( - &self, - package_address: S, - ) -> Result { - self.decode_package_address(package_address) - .map(|package_address| NetworkAwarePackageAddress { - network_id: self.network_id(), - address: package_address, - }) - } -} diff --git a/radix-engine-toolkit/src/model/address/entity_address.rs b/radix-engine-toolkit/src/model/address/entity_address.rs deleted file mode 100644 index d099748e..00000000 --- a/radix-engine-toolkit/src/model/address/entity_address.rs +++ /dev/null @@ -1,253 +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 crate::model::address::network_aware_address::*; -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 -// ================= - -/// A discriminated union of entity addresses where addresses are serialized as a Bech32m encoded -/// 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")] - address: NetworkAwareComponentAddress, - }, - - /// 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")] - address: NetworkAwareResourceAddress, - }, - - /// 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")] - address: NetworkAwarePackageAddress, - }, -} - -// =========== -// 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 -// =============== - -impl EntityAddress { - pub fn kind(&self) -> EntityType { - match self { - Self::ComponentAddress { address } => match address.address { - scrypto::prelude::ComponentAddress::Normal(_) - | scrypto::prelude::ComponentAddress::AccessController(_) => { - EntityType::NormalComponent - } - scrypto::prelude::ComponentAddress::Account(_) => EntityType::AccountComponent, - scrypto::prelude::ComponentAddress::EcdsaSecp256k1VirtualAccount(_) => { - EntityType::EcdsaSecp256k1VirtualAccountComponent - } - scrypto::prelude::ComponentAddress::EddsaEd25519VirtualAccount(_) => { - EntityType::EddsaEd25519VirtualAccountComponent - } - scrypto::prelude::ComponentAddress::Identity(_) => EntityType::IdentityComponent, - scrypto::prelude::ComponentAddress::EcdsaSecp256k1VirtualIdentity(_) => { - EntityType::EcdsaSecp256k1VirtualIdentityComponent - } - scrypto::prelude::ComponentAddress::EddsaEd25519VirtualIdentity(_) => { - EntityType::EddsaEd25519VirtualIdentityComponent - } - scrypto::prelude::ComponentAddress::Clock(_) => EntityType::Clock, - scrypto::prelude::ComponentAddress::EpochManager(_) => EntityType::EpochManager, - scrypto::prelude::ComponentAddress::Validator(_) => EntityType::Validator, - }, - Self::ResourceAddress { address } => match address.address { - scrypto::prelude::ResourceAddress::Fungible(_) => EntityType::FungibleResource, - scrypto::prelude::ResourceAddress::NonFungible(_) => { - EntityType::NonFungibleResource - } - }, - Self::PackageAddress { address } => match address.address { - scrypto::prelude::PackageAddress::Normal(_) => EntityType::Package, - }, - } - } - - pub fn network_id(&self) -> u8 { - match self { - Self::ComponentAddress { address } => address.network_id, - Self::ResourceAddress { address } => address.network_id, - Self::PackageAddress { address } => address.network_id, - } - } - - pub fn from_u8_array(array: &[u8], network_id: u8) -> Result { - if let Ok(address) = NetworkAwareComponentAddress::from_u8_array(array, network_id) { - Ok(Self::ComponentAddress { address }) - } else if let Ok(address) = NetworkAwareResourceAddress::from_u8_array(array, network_id) { - Ok(Self::ResourceAddress { address }) - } else if let Ok(address) = NetworkAwarePackageAddress::from_u8_array(array, network_id) { - Ok(Self::PackageAddress { address }) - } else { - Err(Error::UnrecognizedAddressFormat) - } - } -} - -// ===== -// Text -// ===== - -impl Display for EntityAddress { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - EntityAddress::ComponentAddress { address } => write!(f, "{}", address), - EntityAddress::ResourceAddress { address } => write!(f, "{}", address), - EntityAddress::PackageAddress { address } => write!(f, "{}", address), - } - } -} - -impl FromStr for EntityAddress { - type Err = Error; - - fn from_str(s: &str) -> Result { - if let Ok(address) = NetworkAwareComponentAddress::from_str(s) { - Ok(Self::ComponentAddress { address }) - } else if let Ok(address) = NetworkAwareResourceAddress::from_str(s) { - Ok(Self::ResourceAddress { address }) - } else if let Ok(address) = NetworkAwarePackageAddress::from_str(s) { - Ok(Self::PackageAddress { address }) - } else { - Err(Error::UnrecognizedAddressFormat) - } - } -} - -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 deleted file mode 100644 index 3ca7d44f..00000000 --- a/radix-engine-toolkit/src/model/address/entity_type.rs +++ /dev/null @@ -1,104 +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 scrypto::address::EntityType as NativeEntityType; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// An enum describing the different entity types in the Radix Engine and Scrypto -#[serializable] -pub enum EntityType { - FungibleResource, - NonFungibleResource, - Package, - NormalComponent, - AccountComponent, - EcdsaSecp256k1VirtualAccountComponent, - EddsaEd25519VirtualAccountComponent, - EpochManager, - Clock, - Validator, - IdentityComponent, - EcdsaSecp256k1VirtualIdentityComponent, - EddsaEd25519VirtualIdentityComponent, - AccessControllerComponent, -} - -// ============ -// Conversions -// ============ - -impl From for NativeEntityType { - fn from(value: EntityType) -> Self { - match value { - EntityType::FungibleResource => Self::FungibleResource, - EntityType::NonFungibleResource => Self::NonFungibleResource, - EntityType::Package => Self::Package, - EntityType::NormalComponent => Self::NormalComponent, - EntityType::AccountComponent => Self::AccountComponent, - EntityType::EcdsaSecp256k1VirtualAccountComponent => { - Self::EcdsaSecp256k1VirtualAccountComponent - } - EntityType::EddsaEd25519VirtualAccountComponent => { - Self::EddsaEd25519VirtualAccountComponent - } - EntityType::EpochManager => Self::EpochManager, - EntityType::Clock => Self::Clock, - EntityType::Validator => Self::Validator, - EntityType::IdentityComponent => Self::IdentityComponent, - EntityType::EcdsaSecp256k1VirtualIdentityComponent => { - Self::EcdsaSecp256k1VirtualIdentityComponent - } - EntityType::EddsaEd25519VirtualIdentityComponent => { - Self::EddsaEd25519VirtualIdentityComponent - } - EntityType::AccessControllerComponent => Self::AccessControllerComponent, - } - } -} - -impl From for EntityType { - fn from(value: NativeEntityType) -> Self { - match value { - NativeEntityType::FungibleResource => Self::FungibleResource, - NativeEntityType::NonFungibleResource => Self::NonFungibleResource, - NativeEntityType::Package => Self::Package, - NativeEntityType::NormalComponent => Self::NormalComponent, - NativeEntityType::AccountComponent => Self::AccountComponent, - NativeEntityType::EcdsaSecp256k1VirtualAccountComponent => { - Self::EcdsaSecp256k1VirtualAccountComponent - } - NativeEntityType::EddsaEd25519VirtualAccountComponent => { - Self::EddsaEd25519VirtualAccountComponent - } - NativeEntityType::EpochManager => Self::EpochManager, - NativeEntityType::Clock => Self::Clock, - NativeEntityType::Validator => Self::Validator, - NativeEntityType::IdentityComponent => Self::IdentityComponent, - NativeEntityType::EcdsaSecp256k1VirtualIdentityComponent => { - Self::EcdsaSecp256k1VirtualIdentityComponent - } - NativeEntityType::EddsaEd25519VirtualIdentityComponent => { - Self::EddsaEd25519VirtualIdentityComponent - } - NativeEntityType::AccessControllerComponent => Self::AccessControllerComponent, - } - } -} diff --git a/radix-engine-toolkit/src/model/address/network_aware_address.rs b/radix-engine-toolkit/src/model/address/network_aware_address.rs deleted file mode 100644 index a6d7415f..00000000 --- a/radix-engine-toolkit/src/model/address/network_aware_address.rs +++ /dev/null @@ -1,111 +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 std::fmt::Display; -use std::str::FromStr; - -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. -macro_rules! define_network_aware_address { - ( - $underlying_type: ty => $network_aware_struct_ident: ident, - $encoding_method_ident: ident, - $decoding_method_ident: ident - ) => { - #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, PartialOrd, Ord)] - pub struct $network_aware_struct_ident { - pub network_id: u8, - pub address: $underlying_type, - } - impl From<$network_aware_struct_ident> for $underlying_type { - fn from(address: $network_aware_struct_ident) -> $underlying_type { - address.address - } - } - - impl $network_aware_struct_ident { - pub fn from_u8_array(data: &[u8], network_id: u8) -> Result { - if let Ok(address) = <$underlying_type>::try_from(data) { - Ok($network_aware_struct_ident { - network_id, - address, - }) - } else { - Err(Error::UnrecognizedAddressFormat) - } - } - } - - impl Display for $network_aware_struct_ident { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let bech32_coder = Bech32Coder::new(self.network_id); - write!(f, "{}", bech32_coder.$encoding_method_ident(&self.address)) - } - } - - impl FromStr for $network_aware_struct_ident { - type Err = Error; - - fn from_str(s: &str) -> Result { - let bech32_coder = Bech32Coder::new_from_address(s)?; - Ok(Self { - address: bech32_coder.$decoding_method_ident(s)?, - network_id: bech32_coder.network_id(), - }) - } - } - - /// 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 - } - } - }; -} - -define_network_aware_address!( - scrypto::prelude::ComponentAddress => NetworkAwareComponentAddress, - encode_component_address, - decode_component_address -); -define_network_aware_address!( - scrypto::prelude::PackageAddress => NetworkAwarePackageAddress, - encode_package_address, - decode_package_address -); -define_network_aware_address!( - scrypto::prelude::ResourceAddress => NetworkAwareResourceAddress, - encode_resource_address, - decode_resource_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 deleted file mode 100644 index e996d4c9..00000000 --- a/radix-engine-toolkit/src/model/address/non_fungible_global_id.rs +++ /dev/null @@ -1,77 +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::model::address::EntityAddress; -use scrypto::prelude::{ - FromPublicKey, NonFungibleGlobalId as NativeNonFungibleGlobalId, NonFungibleLocalId, PublicKey, -}; -use toolkit_derive::serializable; - -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 = "EntityAddress")] - #[serde_as(as = "serde_with::TryFromInto")] - pub resource_address: NetworkAwareResourceAddress, - - #[serde_as(as = "serde_with::TryFromInto")] - #[schemars(with = "crate::model::address::NonFungibleLocalId")] - pub non_fungible_local_id: NonFungibleLocalId, -} - -impl NonFungibleGlobalId { - pub fn new( - resource_address: NetworkAwareResourceAddress, - non_fungible_local_id: NonFungibleLocalId, - ) -> Self { - Self { - resource_address, - non_fungible_local_id, - } - } - - pub fn from_public_key + Clone>(public_key: &P, network_id: u8) -> Self { - let native_non_fungible_global_id = NativeNonFungibleGlobalId::from_public_key(public_key); - Self { - resource_address: NetworkAwareResourceAddress { - network_id, - address: native_non_fungible_global_id.resource_address(), - }, - non_fungible_local_id: native_non_fungible_global_id.local_id().clone(), - } - } -} - -impl From for scrypto::prelude::NonFungibleGlobalId { - fn from(value: NonFungibleGlobalId) -> Self { - scrypto::prelude::NonFungibleGlobalId::new( - value.resource_address.address, - value.non_fungible_local_id, - ) - } -} 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 deleted file mode 100644 index af37014b..00000000 --- a/radix-engine-toolkit/src/model/address/non_fungible_local_id.rs +++ /dev/null @@ -1,99 +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 scrypto::prelude::{ - BytesNonFungibleLocalId, IntegerNonFungibleLocalId, - NonFungibleLocalId as ScryptoNonFungibleLocalId, StringNonFungibleLocalId, - UUIDNonFungibleLocalId, -}; -use toolkit_derive::serializable; - -use crate::error::{Error, Result}; - -#[serializable] -#[serde(tag = "type", content = "value")] -/// Represents non-fungible ids which is a discriminated union of the different types that -/// 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")] - #[serde_as(as = "serde_with::DisplayFromStr")] - u64, - ), - - // 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")] - #[serde_as(as = "serde_with::DisplayFromStr")] - u128, - ), - - /// 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")] - #[serde_as(as = "serde_with::hex::Hex")] - #[schemars(length(min = 2, max = 128))] - Vec, - ), - - /// 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), -} - -impl TryFrom for NonFungibleLocalId { - type Error = Error; - - fn try_from(value: ScryptoNonFungibleLocalId) -> Result { - match value { - ScryptoNonFungibleLocalId::Integer(value) => Ok(Self::Integer(value.value())), - ScryptoNonFungibleLocalId::UUID(value) => Ok(Self::UUID(value.value())), - ScryptoNonFungibleLocalId::String(value) => Ok(Self::String(value.value().to_owned())), - ScryptoNonFungibleLocalId::Bytes(value) => Ok(Self::Bytes(value.value().to_owned())), - } - } -} - -impl TryFrom for ScryptoNonFungibleLocalId { - type Error = Error; - - fn try_from(value: NonFungibleLocalId) -> Result { - match value { - NonFungibleLocalId::Integer(value) => { - Ok(Self::Integer(IntegerNonFungibleLocalId::new(value))) - } - NonFungibleLocalId::UUID(value) => UUIDNonFungibleLocalId::new(value) - .map(Self::UUID) - .map_err(Error::from), - NonFungibleLocalId::String(value) => StringNonFungibleLocalId::new(value) - .map(Self::String) - .map_err(Error::from), - NonFungibleLocalId::Bytes(value) => BytesNonFungibleLocalId::new(value) - .map(Self::Bytes) - .map_err(Error::from), - } - } -} diff --git a/radix-engine-toolkit/src/model/constants.rs b/radix-engine-toolkit/src/model/constants.rs deleted file mode 100644 index 9c480ee2..00000000 --- a/radix-engine-toolkit/src/model/constants.rs +++ /dev/null @@ -1,20 +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. - -/// 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 deleted file mode 100644 index e9b29c72..00000000 --- a/radix-engine-toolkit/src/model/crypto/public_key.rs +++ /dev/null @@ -1,76 +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 scrypto::prelude::{EcdsaSecp256k1PublicKey, EddsaEd25519PublicKey}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// A discriminated union of the possible public keys used by Scrypto and the Radix Engine. -#[serializable] -#[serde(tag = "curve")] -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]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - public_key: EcdsaSecp256k1PublicKey, - }, - - /// 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]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - public_key: EddsaEd25519PublicKey, - }, -} - -// ============ -// Conversions -// ============ - -impl From for scrypto::prelude::PublicKey { - fn from(value: PublicKey) -> Self { - match value { - PublicKey::EcdsaSecp256k1 { public_key } => Self::EcdsaSecp256k1(public_key), - PublicKey::EddsaEd25519 { public_key } => Self::EddsaEd25519(public_key), - } - } -} - -impl From for PublicKey { - fn from(value: scrypto::prelude::PublicKey) -> Self { - match value { - scrypto::prelude::PublicKey::EcdsaSecp256k1(public_key) => { - Self::EcdsaSecp256k1 { public_key } - } - scrypto::prelude::PublicKey::EddsaEd25519(public_key) => { - Self::EddsaEd25519 { public_key } - } - } - } -} diff --git a/radix-engine-toolkit/src/model/crypto/signature.rs b/radix-engine-toolkit/src/model/crypto/signature.rs deleted file mode 100644 index a45e77fd..00000000 --- a/radix-engine-toolkit/src/model/crypto/signature.rs +++ /dev/null @@ -1,82 +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 native_transaction::{ - ecdsa_secp256k1::EcdsaSecp256k1Signature, eddsa_ed25519::EddsaEd25519Signature, -}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// A discriminated union of the possible cryptographic signatures used by Scrypto and the Radix -/// Engine. -#[serializable] -#[serde(tag = "curve")] -pub enum Signature { - /// 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. - #[schemars(example = "crate::example::crypto::signature1")] - EcdsaSecp256k1 { - #[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 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]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - signature: EddsaEd25519Signature, - }, -} - -// ============ -// Conversions -// ============ - -impl From for native_transaction::model::Signature { - fn from(value: Signature) -> Self { - match value { - Signature::EcdsaSecp256k1 { signature } => Self::EcdsaSecp256k1(signature), - Signature::EddsaEd25519 { signature } => Self::EddsaEd25519(signature), - } - } -} - -impl From for Signature { - fn from(value: native_transaction::model::Signature) -> Self { - match value { - native_transaction::model::Signature::EcdsaSecp256k1(signature) => { - Self::EcdsaSecp256k1 { 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 deleted file mode 100644 index b10ca8be..00000000 --- a/radix-engine-toolkit/src/model/crypto/signature_with_public_key.rs +++ /dev/null @@ -1,106 +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 native_transaction::ecdsa_secp256k1::EcdsaSecp256k1Signature; -use native_transaction::eddsa_ed25519::EddsaEd25519Signature; -use scrypto::prelude::EddsaEd25519PublicKey; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// A discriminated union of the possible pairs of signatures and public keys used by Scrypto and -/// the Radix Engine. -#[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 - /// 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. In this - /// case, only a signature is needed since the public key can be derived from the - /// signature if the message is available. - #[schemars(length(equal = 130))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - signature: EcdsaSecp256k1Signature, - }, - - /// 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. - #[schemars(length(equal = 66))] - #[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. - #[schemars(length(equal = 128))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - signature: EddsaEd25519Signature, - }, -} - -// ============ -// Conversions -// ============ - -impl From for native_transaction::model::SignatureWithPublicKey { - fn from(value: SignatureWithPublicKey) -> Self { - match value { - SignatureWithPublicKey::EcdsaSecp256k1 { signature } => { - Self::EcdsaSecp256k1 { signature } - } - SignatureWithPublicKey::EddsaEd25519 { - signature, - public_key, - } => Self::EddsaEd25519 { - signature, - public_key, - }, - } - } -} - -impl From for SignatureWithPublicKey { - fn from(value: native_transaction::model::SignatureWithPublicKey) -> Self { - match value { - native_transaction::model::SignatureWithPublicKey::EcdsaSecp256k1 { signature } => { - Self::EcdsaSecp256k1 { signature } - } - native_transaction::model::SignatureWithPublicKey::EddsaEd25519 { - signature, - public_key, - } => Self::EddsaEd25519 { - signature, - public_key, - }, - } - } -} diff --git a/radix-engine-toolkit/src/model/engine_identifier/node_identifier.rs b/radix-engine-toolkit/src/model/engine_identifier/node_identifier.rs deleted file mode 100644 index d34f9c1a..00000000 --- a/radix-engine-toolkit/src/model/engine_identifier/node_identifier.rs +++ /dev/null @@ -1,70 +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 radix_engine_common::data::scrypto::model::OBJECT_ID_LENGTH; -use std::fmt::Display; -use std::str::FromStr; - -use toolkit_derive::serializable; - -use crate::error::{Error, Result}; -use crate::utils::checked_copy_u8_slice; - -// ================= -// Model Definition -// ================= - -#[serializable] -/// 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.) -#[derive(PartialEq, PartialOrd, Eq, Ord, Hash)] -pub struct NodeIdentifier( - #[schemars(length(equal = 31))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::hex::Hex")] - pub [u8; OBJECT_ID_LENGTH], -); - -// ===== -// Text -// ===== - -impl Display for NodeIdentifier { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", hex::encode(self.0)) - } -} - -impl FromStr for NodeIdentifier { - type Err = Error; - - fn from_str(s: &str) -> Result { - // Attempt the decode the string as a hex-string - let bytes = hex::decode(s)?; - - // Check that the decoded bytes are of the expected length - error out if they're not - if bytes.len() != OBJECT_ID_LENGTH { - Err(Error::InvalidLength { - expected: OBJECT_ID_LENGTH, - found: bytes.len(), - }) - } else { - 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 deleted file mode 100644 index 6a6d3a74..00000000 --- a/radix-engine-toolkit/src/model/engine_identifier/own.rs +++ /dev/null @@ -1,69 +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::model::engine_identifier::NodeIdentifier; -use scrypto::runtime::Own as ScryptoOwn; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -#[serializable] -#[serde(tag = "type", content = "value")] -/// Represents a tagged enum of Radix Engine Nodes which may be owned in the point of view of the -/// transaction manifest. -pub enum Own { - /// Represents an owned KeyValueStore - KeyValueStore(NodeIdentifier), - - /// Represents an owned Object - Object(NodeIdentifier), - - /// Represents an owned Vault - Vault(NodeIdentifier), - - /// Represents an owned Bucket - Bucket(NodeIdentifier), - - /// Represents an owned Proof - Proof(NodeIdentifier), -} - -impl From for Own { - fn from(value: ScryptoOwn) -> Self { - match value { - ScryptoOwn::Bucket(v) => Self::Bucket(NodeIdentifier(v)), - ScryptoOwn::Proof(v) => Self::Proof(NodeIdentifier(v)), - ScryptoOwn::KeyValueStore(v) => Self::KeyValueStore(NodeIdentifier(v)), - ScryptoOwn::Object(v) => Self::Object(NodeIdentifier(v)), - ScryptoOwn::Vault(v) => Self::Vault(NodeIdentifier(v)), - } - } -} - -impl From for ScryptoOwn { - fn from(value: Own) -> Self { - match value { - Own::Bucket(v) => Self::Bucket(v.0), - Own::Proof(v) => Self::Proof(v.0), - Own::KeyValueStore(v) => Self::KeyValueStore(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 deleted file mode 100644 index 73d83afd..00000000 --- a/radix-engine-toolkit/src/model/engine_identifier/transient_identifier.rs +++ /dev/null @@ -1,115 +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 std::str::FromStr; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -#[serializable] -#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)] -#[serde(tag = "type")] -/// 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) -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]+"))] - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - value: u32, - }, -} - -#[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); - -// ============ -// Conversions -// ============ - -impl FromStr for TransientIdentifier { - type Err = Error; - - fn from_str(s: &str) -> Result { - Ok(Self::String { - value: s.to_owned(), - }) - } -} - -impl From for TransientIdentifier { - fn from(identifier: String) -> Self { - Self::String { value: identifier } - } -} - -impl From for TransientIdentifier { - fn from(identifier: u32) -> Self { - Self::U32 { value: identifier } - } -} - -impl From for BucketId { - fn from(identifier: TransientIdentifier) -> Self { - Self(identifier) - } -} - -impl From for TransientIdentifier { - fn from(bucket_id: BucketId) -> Self { - bucket_id.0 - } -} - -impl From for ProofId { - fn from(identifier: TransientIdentifier) -> Self { - Self(identifier) - } -} - -impl From for TransientIdentifier { - fn from(proof_id: ProofId) -> Self { - proof_id.0 - } -} diff --git a/radix-engine-toolkit/src/model/instruction.rs b/radix-engine-toolkit/src/model/instruction.rs deleted file mode 100644 index 08f13292..00000000 --- a/radix-engine-toolkit/src/model/instruction.rs +++ /dev/null @@ -1,1322 +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 std::collections::BTreeSet; - -use crate::error::Result; -use crate::model::address::Bech32Coder; -use crate::model::value::ast::ManifestAstValue; - -use native_transaction::manifest::ast; - -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 -// update the toolkit, do a diff against the commit above and the latest commit and update -// based on that. Also, make sure to update the commit hash above. -// https://github.com/radixdlt/radixdlt-scrypto/compare/old_commit_hash..new_commit_hash - -// ================= -// Model Definition -// ================= - -/// The Instruction model defines the structure that transaction manifest instructions follow during -/// communication with the Radix Engine Toolkit -#[serializable] -#[serde(tag = "instruction", rename_all = "SCREAMING_SNAKE_CASE")] -#[derive(Eq, PartialEq)] -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 - /// `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 ManifestAstValue model. - blueprint_name: ManifestAstValue, - - /// A string of the name of the function to call. This field is serialized as a `String` - /// from the ManifestAstValue model. - function_name: ManifestAstValue, - - /// 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 ManifestAstValue model. - component_address: ManifestAstValue, - - /// A string of the name of the method to call. his field is serialized as a `String` from - /// the ManifestAstValue model. - method_name: ManifestAstValue, - - /// 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 ManifestAstValue model. - resource_address: ManifestAstValue, - - /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from - /// 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 ManifestAstValue model. - resource_address: ManifestAstValue, - - /// The amount of the resource to take from the worktop. This field is serialized as a - /// `Decimal` from the ManifestAstValue model. - amount: ManifestAstValue, - - /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from - /// 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 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 ManifestAstValue model. - #[schemars(with = "BTreeSet")] - ids: Vec, - - /// A bucket to put the taken resources into. This field is serialized as a `Bucket` from - /// 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: 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 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 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 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 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 ManifestAstValue - /// model. - #[schemars(with = "BTreeSet")] - 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 - /// 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 - /// 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 ManifestAstValue model. - resource_address: ManifestAstValue, - - /// A proof to put the resource proof into. This field is serialized as a `Proof` from the - /// 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 ManifestAstValue model. - resource_address: ManifestAstValue, - - /// The amount of the resource to create a proof of. This field is serialized as a - /// `Decimal` from the ManifestAstValue model. - amount: ManifestAstValue, - - /// A proof to put the resource proof into. This field is serialized as a `Proof` from the - /// 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 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 ManifestAstValue model. - #[schemars(with = "BTreeSet")] - ids: Vec, - - /// A proof to put the resource proof into. This field is serialized as a `Proof` from the - /// 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 ManifestAstValue model. - bucket: ManifestAstValue, - - /// The proof variable that the proof should go to. This field is serialized as a `Proof` - /// 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 ManifestAstValue model. - proof: ManifestAstValue, - - /// The proof variable that the proof should go to. This field is serialized as a `Proof` - /// 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 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 - /// ManifestAstValue model. - code: ManifestAstValue, - - /// 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 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 ManifestAstValue model. - metadata: ManifestAstValue, - - /// 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: 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: ManifestAstValue, - - /// The amount of tokens to recall from the vault. This field is serialized as a `Decimal` - /// 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: ManifestAstValue, - - /// A string of the key to set the metadata for. This field is serialized as a `String` - /// 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 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 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 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 ManifestAstValue model. - component_address: ManifestAstValue, - - /// 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 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 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: ManifestAstValue, - - /// The method key for the method to set the access rule of. This field is serialized as an - /// `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 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 ManifestAstValue model. - resource_address: ManifestAstValue, - - /// The amount of fungible tokens to mint of this resource. This field is serialized as a - /// `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 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 `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 ManifestAstValue model. - resource_address: ManifestAstValue, - - /// 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. - 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 - /// 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 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 - /// ManifestAstValue model. - access_rules: ManifestAstValue, - }, - - /// 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 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 - /// ManifestAstValue model. - access_rules: ManifestAstValue, - - /// 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 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 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 - /// ManifestAstValue model. - access_rules: ManifestAstValue, - }, - - /// 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 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 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 - /// 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 - /// `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 `ManifestAstValue` model. - controlled_asset: ManifestAstValue, - - /// 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 `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 `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 - /// `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 `ManifestAstValue` model. - key: ManifestAstValue, - - /// 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. - 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, - }, -} - -// ============ -// Conversions -// ============ - -impl Instruction { - pub fn to_ast_instruction(&self, bech32_coder: &Bech32Coder) -> Result { - let ast_instruction = match self { - Self::CallFunction { - package_address, - blueprint_name, - function_name, - arguments, - } => ast::Instruction::CallFunction { - package_address: package_address.to_ast_value(bech32_coder)?, - 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)) - .collect::>>()?, - }, - Self::CallMethod { - component_address, - method_name, - arguments, - } => ast::Instruction::CallMethod { - 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)) - .collect::>>()?, - }, - Self::TakeFromWorktop { - resource_address, - into_bucket, - } => ast::Instruction::TakeFromWorktop { - resource_address: resource_address.to_ast_value(bech32_coder)?, - new_bucket: into_bucket.to_ast_value(bech32_coder)?, - }, - Self::TakeFromWorktopByAmount { - amount, - resource_address, - into_bucket, - } => ast::Instruction::TakeFromWorktopByAmount { - amount: amount.to_ast_value(bech32_coder)?, - resource_address: resource_address.to_ast_value(bech32_coder)?, - new_bucket: into_bucket.to_ast_value(bech32_coder)?, - }, - Self::TakeFromWorktopByIds { - ids, - resource_address, - into_bucket, - } => ast::Instruction::TakeFromWorktopByIds { - 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)?, - new_bucket: into_bucket.to_ast_value(bech32_coder)?, - }, - Self::ReturnToWorktop { bucket } => ast::Instruction::ReturnToWorktop { - bucket: bucket.to_ast_value(bech32_coder)?, - }, - - Self::AssertWorktopContains { resource_address } => { - ast::Instruction::AssertWorktopContains { - resource_address: resource_address.to_ast_value(bech32_coder)?, - } - } - Self::AssertWorktopContainsByAmount { - amount, - resource_address, - } => ast::Instruction::AssertWorktopContainsByAmount { - amount: amount.to_ast_value(bech32_coder)?, - resource_address: resource_address.to_ast_value(bech32_coder)?, - }, - Self::AssertWorktopContainsByIds { - ids, - resource_address, - } => ast::Instruction::AssertWorktopContainsByIds { - 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)?, - }, - - Self::PopFromAuthZone { into_proof } => ast::Instruction::PopFromAuthZone { - new_proof: into_proof.to_ast_value(bech32_coder)?, - }, - Self::PushToAuthZone { proof } => ast::Instruction::PushToAuthZone { - proof: proof.to_ast_value(bech32_coder)?, - }, - Self::ClearAuthZone => ast::Instruction::ClearAuthZone, - - Self::CreateProofFromAuthZone { - resource_address, - into_proof, - } => ast::Instruction::CreateProofFromAuthZone { - resource_address: resource_address.to_ast_value(bech32_coder)?, - new_proof: into_proof.to_ast_value(bech32_coder)?, - }, - Self::CreateProofFromAuthZoneByAmount { - amount, - resource_address, - into_proof, - } => ast::Instruction::CreateProofFromAuthZoneByAmount { - amount: amount.to_ast_value(bech32_coder)?, - resource_address: resource_address.to_ast_value(bech32_coder)?, - new_proof: into_proof.to_ast_value(bech32_coder)?, - }, - Self::CreateProofFromAuthZoneByIds { - ids, - resource_address, - into_proof, - } => ast::Instruction::CreateProofFromAuthZoneByIds { - 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)?, - new_proof: into_proof.to_ast_value(bech32_coder)?, - }, - Self::CreateProofFromBucket { bucket, into_proof } => { - ast::Instruction::CreateProofFromBucket { - bucket: bucket.to_ast_value(bech32_coder)?, - new_proof: into_proof.to_ast_value(bech32_coder)?, - } - } - - Self::CloneProof { proof, into_proof } => ast::Instruction::CloneProof { - proof: proof.to_ast_value(bech32_coder)?, - new_proof: into_proof.to_ast_value(bech32_coder)?, - }, - - Self::DropProof { proof } => ast::Instruction::DropProof { - proof: proof.to_ast_value(bech32_coder)?, - }, - Self::DropAllProofs => ast::Instruction::DropAllProofs, - Self::ClearSignatureProofs => ast::Instruction::ClearSignatureProofs, - Self::BurnResource { bucket } => ast::Instruction::BurnResource { - bucket: bucket.to_ast_value(bech32_coder)?, - }, - Self::PublishPackage { - code, - schema, - royalty_config, - metadata, - access_rules, - } => ast::Instruction::PublishPackage { - code: code.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)?, - }, - - Self::RecallResource { vault_id, amount } => ast::Instruction::RecallResource { - vault_id: vault_id.to_ast_value(bech32_coder)?, - amount: amount.to_ast_value(bech32_coder)?, - }, - - Self::SetMetadata { - entity_address, - key, - value, - } => ast::Instruction::SetMetadata { - entity_address: entity_address.to_ast_value(bech32_coder)?, - key: key.to_ast_value(bech32_coder)?, - 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, - } => ast::Instruction::SetPackageRoyaltyConfig { - package_address: package_address.to_ast_value(bech32_coder)?, - royalty_config: royalty_config.to_ast_value(bech32_coder)?, - }, - - Self::SetComponentRoyaltyConfig { - component_address, - royalty_config, - } => ast::Instruction::SetComponentRoyaltyConfig { - component_address: component_address.to_ast_value(bech32_coder)?, - royalty_config: royalty_config.to_ast_value(bech32_coder)?, - }, - - Self::ClaimPackageRoyalty { package_address } => { - ast::Instruction::ClaimPackageRoyalty { - package_address: package_address.to_ast_value(bech32_coder)?, - } - } - - Self::ClaimComponentRoyalty { component_address } => { - ast::Instruction::ClaimComponentRoyalty { - component_address: component_address.to_ast_value(bech32_coder)?, - } - } - - Self::SetMethodAccessRule { - entity_address, - key, - rule, - } => ast::Instruction::SetMethodAccessRule { - entity_address: entity_address.to_ast_value(bech32_coder)?, - key: key.to_ast_value(bech32_coder)?, - rule: rule.to_ast_value(bech32_coder)?, - }, - - Self::CreateFungibleResource { - divisibility, - metadata, - access_rules, - } => 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)?, - }, - Self::CreateFungibleResourceWithInitialSupply { - divisibility, - metadata, - access_rules, - initial_supply, - } => ast::Instruction::CreateFungibleResourceWithInitialSupply { - 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::CreateNonFungibleResource { - id_type, - schema, - metadata, - access_rules, - } => 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)?, - }, - Self::CreateNonFungibleResourceWithInitialSupply { - id_type, - schema, - metadata, - access_rules, - initial_supply, - } => 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)?, - access_rules: access_rules.to_ast_value(bech32_coder)?, - initial_supply: initial_supply.to_ast_value(bech32_coder)?, - }, - Self::MintFungible { - resource_address, - amount, - } => ast::Instruction::MintFungible { - resource_address: resource_address.to_ast_value(bech32_coder)?, - amount: amount.to_ast_value(bech32_coder)?, - }, - Self::MintNonFungible { - resource_address, - entries, - } => ast::Instruction::MintNonFungible { - resource_address: resource_address.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)?, - 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, - rule_set, - timed_recovery_delay_in_minutes, - } => ast::Instruction::CreateAccessController { - controlled_asset: controlled_asset.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)?, - }, - Self::CreateIdentity { access_rule } => ast::Instruction::CreateIdentity { - access_rule: access_rule.to_ast_value(bech32_coder)?, - }, - Self::CreateValidator { - key, - owner_access_rule, - } => ast::Instruction::CreateValidator { - 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) - } - - pub fn from_ast_instruction( - ast_instruction: &ast::Instruction, - bech32_coder: &Bech32Coder, - ) -> Result { - let instruction = match ast_instruction { - ast::Instruction::CallFunction { - package_address, - blueprint_name, - function_name, - args, - } => Self::CallFunction { - 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| ManifestAstValue::from_ast_value(v, bech32_coder)) - .collect::>>()?; - match arguments.len() { - 0 => None, - _ => Some(arguments), - } - }, - }, - ast::Instruction::CallMethod { - component_address, - method_name, - args, - } => Self::CallMethod { - 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| ManifestAstValue::from_ast_value(v, bech32_coder)) - .collect::>>()?; - match arguments.len() { - 0 => None, - _ => Some(arguments), - } - }, - }, - - ast::Instruction::TakeFromWorktop { - resource_address, - new_bucket, - } => Self::TakeFromWorktop { - 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: 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 ManifestAstValue::Array { - element_kind: _, - elements, - } = ManifestAstValue::from_ast_value(ids, bech32_coder)? - { - elements.into_iter().collect::>() - } else { - panic!("Expected type Array!") - }, - 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: ManifestAstValue::from_ast_value(bucket, bech32_coder)?, - }, - - ast::Instruction::AssertWorktopContains { resource_address } => { - Self::AssertWorktopContains { - resource_address: ManifestAstValue::from_ast_value( - resource_address, - bech32_coder, - )?, - } - } - ast::Instruction::AssertWorktopContainsByAmount { - amount, - resource_address, - } => Self::AssertWorktopContainsByAmount { - 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 ManifestAstValue::Array { - element_kind: _, - elements, - } = ManifestAstValue::from_ast_value(ids, bech32_coder)? - { - elements.into_iter().collect::>() - } else { - panic!("Expected type Array!") - }, - resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, - }, - - ast::Instruction::PopFromAuthZone { new_proof } => Self::PopFromAuthZone { - into_proof: ManifestAstValue::from_ast_value(new_proof, bech32_coder)?, - }, - ast::Instruction::PushToAuthZone { proof } => Self::PushToAuthZone { - proof: ManifestAstValue::from_ast_value(proof, bech32_coder)?, - }, - ast::Instruction::ClearAuthZone => Self::ClearAuthZone, - - ast::Instruction::CreateProofFromAuthZone { - resource_address, - new_proof, - } => Self::CreateProofFromAuthZone { - 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: 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 ManifestAstValue::Array { - element_kind: _, - elements, - } = ManifestAstValue::from_ast_value(ids, bech32_coder)? - { - elements.into_iter().collect::>() - } else { - panic!("Expected type Array!") - }, - 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: 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: ManifestAstValue::from_ast_value(proof, bech32_coder)?, - into_proof: ManifestAstValue::from_ast_value(new_proof, bech32_coder)?, - }, - ast::Instruction::DropProof { proof } => Self::DropProof { - proof: ManifestAstValue::from_ast_value(proof, bech32_coder)?, - }, - ast::Instruction::DropAllProofs => Self::DropAllProofs, - ast::Instruction::ClearSignatureProofs => Self::ClearSignatureProofs, - ast::Instruction::BurnResource { bucket } => Self::BurnResource { - bucket: ManifestAstValue::from_ast_value(bucket, bech32_coder)?, - }, - ast::Instruction::PublishPackage { - code, - schema, - royalty_config, - metadata, - access_rules, - } => Self::PublishPackage { - 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: 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: 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: 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: 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: ManifestAstValue::from_ast_value( - package_address, - bech32_coder, - )?, - } - } - - ast::Instruction::ClaimComponentRoyalty { component_address } => { - Self::ClaimComponentRoyalty { - component_address: ManifestAstValue::from_ast_value( - component_address, - bech32_coder, - )?, - } - } - - ast::Instruction::SetMethodAccessRule { - entity_address, - key, - rule, - } => Self::SetMethodAccessRule { - 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, - } => Self::CreateFungibleResource { - 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::CreateFungibleResourceWithInitialSupply { - divisibility, - metadata, - access_rules, - initial_supply, - } => 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, - } => Self::CreateNonFungibleResource { - 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::CreateNonFungibleResourceWithInitialSupply { - id_type, - schema, - metadata, - access_rules, - initial_supply, - } => 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: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, - amount: ManifestAstValue::from_ast_value(amount, bech32_coder)?, - }, - ast::Instruction::MintNonFungible { - resource_address, - args, - } => Self::MintNonFungible { - resource_address: ManifestAstValue::from_ast_value(resource_address, bech32_coder)?, - entries: ManifestAstValue::from_ast_value(args, bech32_coder)?, - }, - ast::Instruction::MintUuidNonFungible { - resource_address, - args, - } => Self::MintUuidNonFungible { - 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: ManifestAstValue::from_ast_value(access_rule, bech32_coder)?, - }, - ast::Instruction::AssertAccessRule { access_rule } => Self::AssertAccessRule { - access_rule: ManifestAstValue::from_ast_value(access_rule, bech32_coder)?, - }, - ast::Instruction::CreateAccessController { - controlled_asset, - rule_set, - timed_recovery_delay_in_minutes, - } => Self::CreateAccessController { - 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, - )?, - }, - ast::Instruction::CreateValidator { - key, - owner_access_rule, - } => Self::CreateValidator { - 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/resource_specifier.rs b/radix-engine-toolkit/src/model/resource_specifier.rs deleted file mode 100644 index 959e5f3f..00000000 --- a/radix-engine-toolkit/src/model/resource_specifier.rs +++ /dev/null @@ -1,60 +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::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 deleted file mode 100644 index b29246e4..00000000 --- a/radix-engine-toolkit/src/model/runtime/blob.rs +++ /dev/null @@ -1,44 +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 scrypto::prelude::ManifestBlobRef; -use toolkit_derive::serializable; - -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 -/// a byte array of 32 bytes which is serialized as a hex string. -pub struct Blob( - #[schemars(with = "String")] - #[schemars(length(equal = 64))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - [u8; RADIX_ENGINE_HASH_LENGTH], -); - -impl From for Blob { - fn from(value: ManifestBlobRef) -> Self { - Self(value.0) - } -} - -impl From for ManifestBlobRef { - fn from(value: Blob) -> Self { - Self(value.0) - } -} diff --git a/radix-engine-toolkit/src/model/transaction/header.rs b/radix-engine-toolkit/src/model/transaction/header.rs deleted file mode 100644 index d9ae72bb..00000000 --- a/radix-engine-toolkit/src/model/transaction/header.rs +++ /dev/null @@ -1,115 +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 native_transaction::model as native; -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. - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub version: u8, - - /// An 8 bit unsigned integer serialized as a string which represents the id of the network - /// that this transaction is meant for. - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub network_id: u8, - - /// A 64 bit unsigned integer serialized as a string which represents the start of the epoch - /// window in which this transaction executes. This value is inclusive. - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub start_epoch_inclusive: u64, - - /// A 64 bit unsigned integer serialized as a string which represents the end of the epoch - /// window in which this transaction executes. This value is exclusive. - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub end_epoch_exclusive: u64, - - /// A 64 bit unsigned integer serialized as a string which represents a random nonce used for - /// this transaction. - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub nonce: u64, - - /// The public key of the entity that will be notarizing this transaction. - #[schemars(with = "crate::model::crypto::PublicKey")] - #[serde_as(as = "serde_with::FromInto")] - pub notary_public_key: scrypto::prelude::PublicKey, - - /// When `true` the notary's signature is also treated as an intent signature and therefore a - /// virtual badge of the signature is added to the auth zone when the transaction auth zone at - /// the beginning of the transaction. - pub notary_as_signatory: bool, - - /// A 32 bit unsigned integer serialized as a string which represents the limit or maximum - /// amount of cost units that the transaction is allowed to use. - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub cost_unit_limit: u32, - - /// A 16 bit unsigned integer serialized as a string which represents the percentage of tips - /// given to validators for this transaction. - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub tip_percentage: u16, -} - -// ============ -// Conversions -// ============ - -impl From for TransactionHeader { - fn from(value: native::TransactionHeader) -> Self { - Self { - version: value.version, - network_id: value.network_id, - start_epoch_inclusive: value.start_epoch_inclusive, - end_epoch_exclusive: value.end_epoch_exclusive, - nonce: value.nonce, - notary_public_key: value.notary_public_key, - notary_as_signatory: value.notary_as_signatory, - cost_unit_limit: value.cost_unit_limit, - tip_percentage: value.tip_percentage, - } - } -} - -impl From for native::TransactionHeader { - fn from(value: TransactionHeader) -> Self { - Self { - version: value.version, - network_id: value.network_id, - start_epoch_inclusive: value.start_epoch_inclusive, - end_epoch_exclusive: value.end_epoch_exclusive, - nonce: value.nonce, - notary_public_key: value.notary_public_key, - notary_as_signatory: value.notary_as_signatory, - cost_unit_limit: value.cost_unit_limit, - tip_percentage: value.tip_percentage, - } - } -} diff --git a/radix-engine-toolkit/src/model/transaction/instruction_list.rs b/radix-engine-toolkit/src/model/transaction/instruction_list.rs deleted file mode 100644 index be9c13cc..00000000 --- a/radix-engine-toolkit/src/model/transaction/instruction_list.rs +++ /dev/null @@ -1,214 +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::Result; -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 toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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. -#[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), -} - -/// An enum which describes the kind of manifest instructions. -#[serializable] -#[derive(Copy)] -pub enum InstructionKind { - String, - Parsed, -} - -// =============== -// Implementation -// =============== - -impl InstructionList { - pub fn kind(&self) -> InstructionKind { - match self { - Self::String(..) => InstructionKind::String, - Self::Parsed(..) => InstructionKind::Parsed, - } - } - - pub fn ast_instructions(&self, bech32_coder: &Bech32Coder) -> Result> { - match self { - Self::String(string) => { - let tokens = native_transaction::manifest::lexer::tokenize(string) - .map_err(native_transaction::manifest::CompileError::LexerError)?; - - let instructions = native_transaction::manifest::parser::Parser::new(tokens) - .parse_manifest() - .map_err(native_transaction::manifest::CompileError::ParserError)?; - Ok(instructions) - } - Self::Parsed(instructions) => instructions - .iter() - .map(|instruction| instruction.to_ast_instruction(bech32_coder)) - .collect::>>(), - } - } - - pub fn basic_instructions( - &self, - bech32_coder: &Bech32Coder, - // 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> { - let instructions = self.ast_instructions(bech32_coder)?; - let instructions = native_transaction::manifest::generator::generate_manifest( - &instructions, - bech32_coder.decoder(), - blobs.iter().map(|x| (hash(x), x.clone())).collect(), - )? - .instructions; - Ok(instructions) - } - - pub fn convert_to_string( - &self, - bech32_coder: &Bech32Coder, - // 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 { - match self { - Self::String(_) => Ok(self.clone()), - Self::Parsed(_) => { - // The only way to convert a vector of instructions to the string instructions - // understood by the radix transaction manifest compiler is by going through a - // series of steps: - // - // 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::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::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. - // - // Q. Why not re-implement the id-validator validation on this side and skip the - // process of converting between these different types? - // A. The format is changing quite often and these two implementations are bound to - // become out of sync in no time at all. - // - // Q. Why not just implement Vec -> String conversion directly and skip - // all of these steps? - // A. Might be the easiest way to solve this problem, but it means that we lose out - // on all of the validations and everything provided in the Scrypto repo for - // manifests. In addition to that, these two implementations can become out of sync - // in different aspects which is very undesirable. - // - // The above is the cause of some of the quirks that I am not too happy about. Like - // the need to provide the blobs to be able to convert a manifest from one format to - // another. This is a limitation caused by us needing to take this long path to - // converting manifests. In the future, something like this should definitely not - // be required. - // - // 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 - // Conversion (based on above comment). - let instructions = self.basic_instructions(bech32_coder, blobs)?; - - // Vec --> String Conversion (based on above comment) - Ok(Self::String(decompile( - &instructions, - bech32_coder.network_definition(), - )?)) - } - } - } - - pub fn convert_to_parsed( - &self, - bech32_coder: &Bech32Coder, - blobs: Vec>, - ) -> Result { - match self { - Self::Parsed(_) => Ok(self.clone()), - Self::String(_) => { - // This function takes advantage of Scrypto's transaction manifest compiler and uses - // it to parse the transaction manifest instructions into Vec and - // then convert that into the native Instruction type used in this code. - // - // The main problem with using Scrypto's manifest compiler is that we need to rely - // on blobs always being present for the conversion, which makes sense for Scrypto - // but does not make sense for us since we are simply converting the format from one - // kind to another. - // - // Similar to the previous point and previous comment on this, we will need to look - // into long term solutions for this to break away from the limitations of relying - // on the Scrypto toolchain for operations like this. - let ast_instruction = self.ast_instructions(bech32_coder)?; - let instructions = ast_instruction - .iter() - .map(|instruction| Instruction::from_ast_instruction(instruction, bech32_coder)) - .collect::>>() - .map(Self::Parsed); - - // TODO: Remove this validation step in favor of something better. - // This step validates that the instruction format is correct by attempting to - // compile the instructions - match instructions - .clone() - .map(|instructions| instructions.convert_to_string(bech32_coder, blobs)) - { - Ok(..) => instructions, - Err(error) => Err(error), - } - } - } - } - - pub fn convert_to_manifest_instructions_kind( - &self, - manifest_instructions_kind: InstructionKind, - bech32_coder: &Bech32Coder, - // TODO: This is a work around for a larger problem. Should definitely be removed in the - // future. The problem is described in the long comment below. - blobs: Vec>, - ) -> Result { - match manifest_instructions_kind { - InstructionKind::String => self.convert_to_string(bech32_coder, blobs), - InstructionKind::Parsed => self.convert_to_parsed(bech32_coder, blobs), - } - } -} diff --git a/radix-engine-toolkit/src/model/transaction/intent.rs b/radix-engine-toolkit/src/model/transaction/intent.rs deleted file mode 100644 index 51accf8c..00000000 --- a/radix-engine-toolkit/src/model/transaction/intent.rs +++ /dev/null @@ -1,98 +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 scrypto::prelude::{manifest_decode, manifest_encode}; -use toolkit_derive::serializable; - -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::traits::CompilableIntent; -use native_transaction::model as native; - -// ================= -// Model Definition -// ================= - -/// 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, - - /// A transaction manifest of the transaction instructions and blobs. - pub manifest: TransactionManifest, -} - -// =============== -// Implementation -// =============== - -impl CompilableIntent for TransactionIntent { - fn compile(&self) -> Result> { - self.to_native_transaction_intent() - .and_then(|intent| manifest_encode(&intent).map_err(Error::from)) - } - - fn decompile(data: &T, instructions_kind: InstructionKind) -> Result - where - Self: Sized, - T: AsRef<[u8]>, - { - manifest_decode(data.as_ref()) - .map_err(Error::from) - .and_then(|decoded| Self::from_native_transaction_intent(&decoded, instructions_kind)) - } -} - -// ============ -// Conversions -// ============ - -impl TransactionIntent { - pub fn from_native_transaction_intent( - native_transaction_intent: &native::TransactionIntent, - instructions_kind: InstructionKind, - ) -> Result { - let bech32_coder = Bech32Coder::new(native_transaction_intent.header.network_id); - - TransactionManifest::from_native_manifest( - &native_transaction_intent.manifest, - instructions_kind, - &bech32_coder, - ) - .map(|transaction_manifest| Self { - manifest: transaction_manifest, - header: native_transaction_intent.header.clone().into(), - }) - } - - pub fn to_native_transaction_intent(&self) -> Result { - let bech32_coder = Bech32Coder::new(self.header.network_id); - - self.manifest - .to_native_manifest(&bech32_coder) - .map(|transaction_manifest| native::TransactionIntent { - manifest: transaction_manifest, - header: self.header.clone().into(), - }) - } -} diff --git a/radix-engine-toolkit/src/model/transaction/manifest.rs b/radix-engine-toolkit/src/model/transaction/manifest.rs deleted file mode 100644 index d285441e..00000000 --- a/radix-engine-toolkit/src/model/transaction/manifest.rs +++ /dev/null @@ -1,83 +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 crate::model::address::Bech32Coder; -use crate::model::transaction::{InstructionKind, InstructionList}; -use native_transaction::manifest::decompile; -use native_transaction::model as native; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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, - - /// An array of byte arrays which is serialized as an array of hex strings which represents the - /// blobs included in the transaction. - #[schemars(with = "Vec")] - #[serde_as(as = "Vec")] - pub blobs: Vec>, -} - -// ============ -// Conversions -// ============ - -impl TransactionManifest { - pub fn from_native_manifest( - native_manifest: &native::TransactionManifest, - instructions_kind: InstructionKind, - bech32_coder: &Bech32Coder, - ) -> Result { - decompile( - &native_manifest.instructions, - bech32_coder.network_definition(), - ) - .map(InstructionList::String) - .map_err(Error::from) - .and_then(|instructions| { - instructions.convert_to_manifest_instructions_kind( - instructions_kind, - bech32_coder, - native_manifest.blobs.clone(), - ) - }) - .map(|instructions| TransactionManifest { - instructions, - blobs: native_manifest.blobs.clone(), - }) - } - - pub fn to_native_manifest( - &self, - bech32_coder: &Bech32Coder, - ) -> Result { - self.instructions - .basic_instructions(bech32_coder, self.blobs.clone()) - .map(|basic_instructions| native::TransactionManifest { - instructions: basic_instructions, - blobs: self.blobs.clone(), - }) - } -} diff --git a/radix-engine-toolkit/src/model/transaction/notarized_intent.rs b/radix-engine-toolkit/src/model/transaction/notarized_intent.rs deleted file mode 100644 index abdf57e3..00000000 --- a/radix-engine-toolkit/src/model/transaction/notarized_intent.rs +++ /dev/null @@ -1,95 +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 crate::model::transaction::{InstructionKind, SignedTransactionIntent}; -use crate::traits::CompilableIntent; -use native_transaction::model as native; -use scrypto::prelude::{manifest_decode, manifest_encode}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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, - - /// 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: native::Signature, -} - -// =============== -// Implementation -// =============== - -impl CompilableIntent for NotarizedTransaction { - fn compile(&self) -> Result> { - self.to_native_notarized_transaction_intent() - .and_then(|notarized_transaction| { - manifest_encode(¬arized_transaction).map_err(Error::from) - }) - } - - fn decompile(data: &T, instructions_kind: InstructionKind) -> Result - where - Self: Sized, - T: AsRef<[u8]>, - { - manifest_decode(data.as_ref()) - .map_err(Error::from) - .and_then(|decoded| { - Self::from_native_notarized_transaction_intent(&decoded, instructions_kind) - }) - } -} - -// ============ -// Conversions -// ============ - -impl NotarizedTransaction { - pub fn from_native_notarized_transaction_intent( - native_notarized_transaction_intent: &native::NotarizedTransaction, - instructions_kind: InstructionKind, - ) -> Result { - SignedTransactionIntent::from_native_signed_transaction_intent( - &native_notarized_transaction_intent.signed_intent, - instructions_kind, - ) - .map(|signed_intent| Self { - signed_intent, - notary_signature: native_notarized_transaction_intent.notary_signature, - }) - } - - pub fn to_native_notarized_transaction_intent(&self) -> Result { - self.signed_intent - .to_native_signed_transaction_intent() - .map(|signed_intent| native::NotarizedTransaction { - signed_intent, - notary_signature: self.notary_signature, - }) - } -} diff --git a/radix-engine-toolkit/src/model/transaction/signed_intent.rs b/radix-engine-toolkit/src/model/transaction/signed_intent.rs deleted file mode 100644 index ead2750b..00000000 --- a/radix-engine-toolkit/src/model/transaction/signed_intent.rs +++ /dev/null @@ -1,92 +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 crate::model::transaction::{InstructionKind, TransactionIntent}; -use crate::traits::CompilableIntent; -use native_transaction::model as native; -use scrypto::prelude::{manifest_decode, manifest_encode}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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, - - /// A vector of transaction intent signatures. - #[schemars(with = "Vec")] - #[serde_as(as = "Vec>")] - pub intent_signatures: Vec, -} - -// =============== -// Implementation -// =============== - -impl CompilableIntent for SignedTransactionIntent { - fn compile(&self) -> Result> { - self.to_native_signed_transaction_intent() - .and_then(|intent| manifest_encode(&intent).map_err(Error::from)) - } - - fn decompile(data: &T, instructions_kind: InstructionKind) -> Result - where - Self: Sized, - T: AsRef<[u8]>, - { - manifest_decode(data.as_ref()) - .map_err(Error::from) - .and_then(|decoded| { - Self::from_native_signed_transaction_intent(&decoded, instructions_kind) - }) - } -} - -// =========== -// Conversion -// =========== - -impl SignedTransactionIntent { - pub fn from_native_signed_transaction_intent( - native_signed_transaction_intent: &native::SignedTransactionIntent, - instructions_kind: InstructionKind, - ) -> Result { - TransactionIntent::from_native_transaction_intent( - &native_signed_transaction_intent.intent, - instructions_kind, - ) - .map(|transaction_intent| Self { - intent: transaction_intent, - intent_signatures: native_signed_transaction_intent.intent_signatures.clone(), - }) - } - - pub fn to_native_signed_transaction_intent(&self) -> Result { - self.intent - .to_native_transaction_intent() - .map(|transaction_intent| native::SignedTransactionIntent { - intent: transaction_intent, - intent_signatures: self.intent_signatures.clone(), - }) - } -} diff --git a/radix-engine-toolkit/src/model/transaction/validation_config.rs b/radix-engine-toolkit/src/model/transaction/validation_config.rs deleted file mode 100644 index 1dc0b91e..00000000 --- a/radix-engine-toolkit/src/model/transaction/validation_config.rs +++ /dev/null @@ -1,92 +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 native_transaction::validation::ValidationConfig as NativeValidationConfig; -use serde_with::{serde_as, DisplayFromStr}; -use toolkit_derive::serializable; - -/// Represents a set of settings to use when statically validating a notarized transaction intent. -#[serializable] -pub struct ValidationConfig { - /// An unsigned 8 bit integer serialized as a string which represents the network id to - /// validate the transaction against. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "DisplayFromStr")] - pub network_id: u8, - - /// An unsigned 32 bit integer serialized as a string which represents the minimum cost unit - /// limit that a transaction is allowed to have. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "DisplayFromStr")] - pub min_cost_unit_limit: u32, - - /// An unsigned 32 bit integer serialized as a string which represents the maximum cost unit - /// limit that a transaction is allowed to have. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "DisplayFromStr")] - pub max_cost_unit_limit: u32, - - /// An unsigned 16 bit integer serialized as a string which represents the minimum tip - /// percentage that a transaction is allowed to have. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "DisplayFromStr")] - pub min_tip_percentage: u16, - - /// An unsigned 16 bit integer serialized as a string which represents the maximum tip - /// percentage that a transaction is allowed to have. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "DisplayFromStr")] - pub max_tip_percentage: u16, - - /// An unsigned 64 bit integer serialized as a string which represents the maximum difference - /// that can exist between the start and end epoch of transactions. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "DisplayFromStr")] - pub max_epoch_range: u64, -} - -impl From for ValidationConfig { - fn from(value: NativeValidationConfig) -> Self { - Self { - network_id: value.network_id, - min_cost_unit_limit: value.min_cost_unit_limit, - max_cost_unit_limit: value.max_cost_unit_limit, - min_tip_percentage: value.min_tip_percentage, - max_tip_percentage: value.max_tip_percentage, - max_epoch_range: value.max_epoch_range, - } - } -} - -impl From for NativeValidationConfig { - fn from(value: ValidationConfig) -> Self { - Self { - network_id: value.network_id, - min_cost_unit_limit: value.min_cost_unit_limit, - max_cost_unit_limit: value.max_cost_unit_limit, - min_tip_percentage: value.min_tip_percentage, - max_tip_percentage: value.max_tip_percentage, - max_epoch_range: value.max_epoch_range, - } - } -} diff --git a/radix-engine-toolkit/src/model/value/ast/bridge.rs b/radix-engine-toolkit/src/model/value/ast/bridge.rs deleted file mode 100644 index 6b50252c..00000000 --- a/radix-engine-toolkit/src/model/value/ast/bridge.rs +++ /dev/null @@ -1,623 +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 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/model.rs b/radix-engine-toolkit/src/model/value/ast/model.rs deleted file mode 100644 index e28aebba..00000000 --- a/radix-engine-toolkit/src/model/value/ast/model.rs +++ /dev/null @@ -1,359 +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::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 deleted file mode 100644 index 1687a987..00000000 --- a/radix-engine-toolkit/src/model/value/macros.rs +++ /dev/null @@ -1,71 +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. - -#[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 deleted file mode 100644 index a050dd62..00000000 --- a/radix-engine-toolkit/src/model/value/manifest_sbor/bridge.rs +++ /dev/null @@ -1,423 +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 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/model.rs b/radix-engine-toolkit/src/model/value/manifest_sbor/model.rs deleted file mode 100644 index 6a8fcab1..00000000 --- a/radix-engine-toolkit/src/model/value/manifest_sbor/model.rs +++ /dev/null @@ -1,279 +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::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/scrypto_sbor/bridge.rs b/radix-engine-toolkit/src/model/value/scrypto_sbor/bridge.rs deleted file mode 100644 index eb867caa..00000000 --- a/radix-engine-toolkit/src/model/value/scrypto_sbor/bridge.rs +++ /dev/null @@ -1,330 +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 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/model.rs b/radix-engine-toolkit/src/model/value/scrypto_sbor/model.rs deleted file mode 100644 index ada4a36e..00000000 --- a/radix-engine-toolkit/src/model/value/scrypto_sbor/model.rs +++ /dev/null @@ -1,259 +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::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/models/common.rs b/radix-engine-toolkit/src/models/common.rs new file mode 100644 index 00000000..1527fa45 --- /dev/null +++ b/radix-engine-toolkit/src/models/common.rs @@ -0,0 +1,139 @@ +// 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 schemars::JsonSchema; +use scrypto::prelude::*; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; + +#[serde_as] +#[derive( + Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, +)] +#[serde(transparent)] +#[schemars(transparent)] +#[schemars(bound = "")] +pub struct AsHex( + #[schemars(with = "String")] + #[serde_as(as = "serde_with::hex::Hex")] + T, +) +where + T: AsRef<[u8]> + TryFrom>; + +impl std::ops::Deref for AsHex +where + T: AsRef<[u8]> + TryFrom>, +{ + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl std::ops::DerefMut for AsHex +where + T: AsRef<[u8]> + TryFrom>, +{ + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +impl From for AsHex +where + T: AsRef<[u8]> + TryFrom>, +{ + fn from(value: T) -> Self { + Self(value) + } +} + +impl Copy for AsHex where T: AsRef<[u8]> + TryFrom> + Copy {} + +#[serde_as] +#[derive( + Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, +)] +#[serde(transparent)] +#[schemars(transparent)] +#[schemars(bound = "")] +pub struct AsStr( + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + T, +) +where + T: Display + FromStr, + ::Err: Display; + +impl std::ops::Deref for AsStr +where + T: Display + FromStr, + ::Err: Display, +{ + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl std::ops::DerefMut for AsStr +where + T: Display + FromStr, + ::Err: Display, +{ + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +impl From for AsStr +where + T: Display + FromStr, + ::Err: Display, +{ + fn from(value: T) -> Self { + Self(value) + } +} + +impl Copy for AsStr +where + T: Display + FromStr + Copy, + ::Err: Display, +{ +} + +pub type SerializableHash = AsStr; +pub type SerializableNonFungibleLocalId = AsStr; +pub type SerializableU8 = AsStr; +pub type SerializableU16 = AsStr; +pub type SerializableU32 = AsStr; +pub type SerializableU64 = AsStr; +pub type SerializableU128 = AsStr; +pub type SerializableI8 = AsStr; +pub type SerializableI16 = AsStr; +pub type SerializableI32 = AsStr; +pub type SerializableI64 = AsStr; +pub type SerializableI128 = AsStr; +pub type SerializableDecimal = AsStr; +pub type SerializablePreciseDecimal = AsStr; + +pub type SerializableBytes = AsHex>; diff --git a/radix-engine-toolkit/src/example/value/mod.rs b/radix-engine-toolkit/src/models/cryptographic/mod.rs similarity index 89% rename from radix-engine-toolkit/src/example/value/mod.rs rename to radix-engine-toolkit/src/models/cryptographic/mod.rs index 4e4a2677..a277b666 100644 --- a/radix-engine-toolkit/src/example/value/mod.rs +++ b/radix-engine-toolkit/src/models/cryptographic/mod.rs @@ -15,6 +15,7 @@ // specific language governing permissions and limitations // under the License. -pub mod ast_value; -pub mod manifest_sbor_value; -pub mod scrypto_sbor_value; +pub mod public_key; +pub mod public_key_hash; +pub mod signature; +pub mod signature_with_public_key; diff --git a/radix-engine-toolkit/src/models/cryptographic/public_key.rs b/radix-engine-toolkit/src/models/cryptographic/public_key.rs new file mode 100644 index 00000000..b63091c0 --- /dev/null +++ b/radix-engine-toolkit/src/models/cryptographic/public_key.rs @@ -0,0 +1,95 @@ +// 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::prelude::{Ed25519PublicKey, PublicKey, Secp256k1PublicKey}; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; + +use crate::prelude::*; + +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, Hash)] +#[serde(tag = "kind")] +pub enum SerializablePublicKey { + Secp256k1 { + value: AsHex<[u8; Secp256k1PublicKey::LENGTH]>, + }, + Ed25519 { + value: AsHex<[u8; Ed25519PublicKey::LENGTH]>, + }, +} + +impl From for SerializablePublicKey { + fn from(value: PublicKey) -> Self { + match value { + PublicKey::Secp256k1(public_key) => Self::Secp256k1 { + value: public_key.0.into(), + }, + PublicKey::Ed25519(public_key) => Self::Ed25519 { + value: public_key.0.into(), + }, + } + } +} + +impl From for PublicKey { + fn from(value: SerializablePublicKey) -> Self { + match value { + SerializablePublicKey::Secp256k1 { value } => { + Self::Secp256k1(Secp256k1PublicKey(*value)) + } + SerializablePublicKey::Ed25519 { value } => Self::Ed25519(Ed25519PublicKey(*value)), + } + } +} + +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, Hash)] +#[schemars(transparent)] +#[serde(transparent)] +pub struct SerializableSecp256k1PublicKey(AsHex<[u8; Secp256k1PublicKey::LENGTH]>); + +impl From for Secp256k1PublicKey { + fn from(value: SerializableSecp256k1PublicKey) -> Self { + Self(*value.0) + } +} + +impl From for SerializableSecp256k1PublicKey { + fn from(value: Secp256k1PublicKey) -> Self { + Self(value.0.into()) + } +} + +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, Hash)] +#[schemars(transparent)] +#[serde(transparent)] +pub struct SerializableEd25519PublicKey(AsHex<[u8; Ed25519PublicKey::LENGTH]>); + +impl From for Ed25519PublicKey { + fn from(value: SerializableEd25519PublicKey) -> Self { + Self(*value.0) + } +} + +impl From for SerializableEd25519PublicKey { + fn from(value: Ed25519PublicKey) -> Self { + Self(value.0.into()) + } +} diff --git a/radix-engine-toolkit/src/models/cryptographic/public_key_hash.rs b/radix-engine-toolkit/src/models/cryptographic/public_key_hash.rs new file mode 100644 index 00000000..6b9f512f --- /dev/null +++ b/radix-engine-toolkit/src/models/cryptographic/public_key_hash.rs @@ -0,0 +1,76 @@ +// 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 schemars::JsonSchema; +use scrypto::prelude::*; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; + +use crate::prelude::*; + +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind")] +pub enum SerializablePublicKeyHash { + Secp256k1 { + value: AsHex<[u8; NodeId::RID_LENGTH]>, + }, + Ed25519 { + value: AsHex<[u8; NodeId::RID_LENGTH]>, + }, +} + +impl From for SerializablePublicKeyHash { + fn from(value: PublicKeyHash) -> Self { + match value { + PublicKeyHash::Secp256k1(public_key) => Self::Secp256k1 { + value: public_key.0.into(), + }, + PublicKeyHash::Ed25519(public_key) => Self::Ed25519 { + value: public_key.0.into(), + }, + } + } +} + +impl From for PublicKeyHash { + fn from(value: SerializablePublicKeyHash) -> Self { + match value { + SerializablePublicKeyHash::Secp256k1 { value } => { + Self::Secp256k1(Secp256k1PublicKeyHash(*value)) + } + SerializablePublicKeyHash::Ed25519 { value } => { + Self::Ed25519(Ed25519PublicKeyHash(*value)) + } + } + } +} + +impl From for SerializablePublicKeyHash { + fn from(value: PublicKey) -> Self { + match value { + PublicKey::Secp256k1(public_key) => Self::Secp256k1 { + value: public_key.to_hash().0.into(), + }, + PublicKey::Ed25519(public_key) => Self::Ed25519 { + value: Ed25519PublicKeyHash::new_from_public_key(&public_key) + .0 + .into(), + }, + } + } +} diff --git a/radix-engine-toolkit/src/models/cryptographic/signature.rs b/radix-engine-toolkit/src/models/cryptographic/signature.rs new file mode 100644 index 00000000..3da9e4b2 --- /dev/null +++ b/radix-engine-toolkit/src/models/cryptographic/signature.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 radix_engine_common::prelude::*; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; +use transaction::prelude::*; + +use crate::prelude::*; + +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind")] +pub enum SerializableSignature { + Secp256k1 { + value: AsHex<[u8; Secp256k1Signature::LENGTH]>, + }, + Ed25519 { + value: AsHex<[u8; Ed25519Signature::LENGTH]>, + }, +} + +impl From for SerializableSignature { + fn from(value: SignatureV1) -> Self { + match value { + SignatureV1::Secp256k1(signature) => Self::Secp256k1 { + value: signature.0.into(), + }, + SignatureV1::Ed25519(signature) => Self::Ed25519 { + value: signature.0.into(), + }, + } + } +} + +impl From for SignatureV1 { + fn from(value: SerializableSignature) -> Self { + match value { + SerializableSignature::Secp256k1 { value } => { + Self::Secp256k1(Secp256k1Signature(*value)) + } + SerializableSignature::Ed25519 { value } => Self::Ed25519(Ed25519Signature(*value)), + } + } +} diff --git a/radix-engine-toolkit/src/models/cryptographic/signature_with_public_key.rs b/radix-engine-toolkit/src/models/cryptographic/signature_with_public_key.rs new file mode 100644 index 00000000..9126e809 --- /dev/null +++ b/radix-engine-toolkit/src/models/cryptographic/signature_with_public_key.rs @@ -0,0 +1,68 @@ +// 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::prelude::*; + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::prelude::*; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind")] +pub enum SerializableSignatureWithPublicKey { + Secp256k1 { + signature: AsHex<[u8; Secp256k1Signature::LENGTH]>, + }, + Ed25519 { + signature: AsHex<[u8; Ed25519Signature::LENGTH]>, + public_key: AsHex<[u8; Ed25519PublicKey::LENGTH]>, + }, +} + +impl From for SerializableSignatureWithPublicKey { + fn from(value: SignatureWithPublicKeyV1) -> Self { + match value { + SignatureWithPublicKeyV1::Secp256k1 { signature } => Self::Secp256k1 { + signature: signature.0.into(), + }, + SignatureWithPublicKeyV1::Ed25519 { + signature, + public_key, + } => Self::Ed25519 { + signature: signature.0.into(), + public_key: public_key.0.into(), + }, + } + } +} + +impl From for SignatureWithPublicKeyV1 { + fn from(value: SerializableSignatureWithPublicKey) -> Self { + match value { + SerializableSignatureWithPublicKey::Secp256k1 { signature } => Self::Secp256k1 { + signature: Secp256k1Signature(*signature), + }, + SerializableSignatureWithPublicKey::Ed25519 { + signature, + public_key, + } => Self::Ed25519 { + signature: Ed25519Signature(*signature), + public_key: Ed25519PublicKey(*public_key), + }, + } + } +} diff --git a/radix-engine-toolkit/src/models/macros.rs b/radix-engine-toolkit/src/models/macros.rs new file mode 100644 index 00000000..cdcf6f38 --- /dev/null +++ b/radix-engine-toolkit/src/models/macros.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. + +macro_rules! define_enum_and_kind { + ( + $(#[$meta: meta])* + $vis: vis enum $name: ident { + $( + $variant_name: ident $({ + $( + $field_name: ident: $field_type: ty + ),* $(,)? + })? + ),* + + $(,)? + } + ) => { + paste::paste! { + #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, schemars::JsonSchema, PartialEq, Eq, Hash)] + #[serde(tag = "kind")] + $vis enum $name { + $( + $variant_name $({ + $( + $field_name: $field_type + ),* + })?, + )* + } + + #[derive(Clone, Copy, Debug, serde::Serialize, serde::Deserialize, schemars::JsonSchema, PartialEq, Eq, Hash)] + $vis enum [< $name Kind >] { + $( + $variant_name, + )* + } + } + }; +} + +pub(crate) use define_enum_and_kind; diff --git a/radix-engine-toolkit/src/models/manifest/mod.rs b/radix-engine-toolkit/src/models/manifest/mod.rs new file mode 100644 index 00000000..a8cdbc5a --- /dev/null +++ b/radix-engine-toolkit/src/models/manifest/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 runtime; diff --git a/radix-engine-toolkit/src/models/manifest/runtime.rs b/radix-engine-toolkit/src/models/manifest/runtime.rs new file mode 100644 index 00000000..ba02b6c6 --- /dev/null +++ b/radix-engine-toolkit/src/models/manifest/runtime.rs @@ -0,0 +1,184 @@ +// 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 schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::prelude::*; + +use crate::prelude::*; + +define_prefixed_id!(SerializableBucketId, ManifestBucket, "bucket"); +define_prefixed_id!(SerializableProofId, ManifestProof, "proof"); +define_prefixed_id!(SerializableNamedAddress, ManifestNamedAddress, "address"); +define_prefixed_id!( + SerializableAddressReservation, + ManifestAddressReservation, + "reservation" +); + +pub struct ManifestNamedAddress(u32); + +#[serde_with::serde_as] +#[derive(Serialize, Deserialize, JsonSchema, Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum SerializableExpression { + EntireWorktop, + EntireAuthZone, +} + +impl From for SerializableExpression { + fn from(value: ManifestExpression) -> Self { + match value { + ManifestExpression::EntireAuthZone => Self::EntireAuthZone, + ManifestExpression::EntireWorktop => Self::EntireWorktop, + } + } +} + +impl From for ManifestExpression { + fn from(value: SerializableExpression) -> Self { + match value { + SerializableExpression::EntireAuthZone => Self::EntireAuthZone, + SerializableExpression::EntireWorktop => Self::EntireWorktop, + } + } +} + +#[serde_with::serde_as] +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, Hash)] +#[serde(tag = "kind")] +pub enum SerializableManifestAddress { + Static { value: SerializableNodeId }, + Named { value: SerializableNamedAddress }, +} + +macro_rules! define_prefixed_id { + ($name: ident, $underlying_type: ty, $prefix: expr) => { + paste::paste! { + define_prefixed_id! { + [< $name >], + [< $name Prefixed >], + $underlying_type, + $prefix + } + } + }; + ($type_name: ident, $prefixed_type_name: ident, $underlying_type: ty, $prefix: expr) => { + #[serde_with::serde_as] + #[derive( + serde::Serialize, + serde::Deserialize, + schemars::JsonSchema, + Clone, + Debug, + Copy, + PartialEq, + Eq, + Hash, + )] + #[schemars(transparent)] + #[serde(transparent)] + pub struct $type_name( + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + $prefixed_type_name, + ); + + impl $type_name { + pub fn new(id: u32) -> Self { + Self($prefixed_type_name(id)) + } + + pub fn value(&self) -> u32 { + self.0 .0 + } + } + + impl From<$type_name> for u32 { + fn from(value: $type_name) -> Self { + value.0 .0 + } + } + + impl From for $type_name { + fn from(value: u32) -> Self { + $type_name($prefixed_type_name(value)) + } + } + + impl From<$underlying_type> for $type_name { + fn from(value: $underlying_type) -> Self { + value.0.into() + } + } + + impl From<$type_name> for $underlying_type { + fn from(value: $type_name) -> Self { + Self(value.0 .0) + } + } + + impl std::ops::Deref for $type_name { + type Target = u32; + + fn deref(&self) -> &Self::Target { + &self.0 .0 + } + } + + impl std::ops::DerefMut for $type_name { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 .0 + } + } + + #[derive(Clone, Debug, Copy, PartialEq, Eq, Hash)] + struct $prefixed_type_name(u32); + + impl $prefixed_type_name { + const PREFIX: &'static str = $prefix; + } + + impl std::fmt::Display for $prefixed_type_name { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}{}", Self::PREFIX, self.0) + } + } + + impl std::str::FromStr for $prefixed_type_name { + type Err = PrefixedIdParseError; + + fn from_str(s: &str) -> Result { + s.replace(Self::PREFIX, "") + .parse() + .map(Self) + .map_err(|error| PrefixedIdParseError::FailedToParseAsU32(format!("{error:?}"))) + } + } + }; +} +use define_prefixed_id; + +#[derive(Clone, Debug)] +pub enum PrefixedIdParseError { + FailedToParseAsU32(String), +} + +impl std::fmt::Display for PrefixedIdParseError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Debug::fmt(&self, f) + } +} diff --git a/radix-engine-toolkit/src/models/mod.rs b/radix-engine-toolkit/src/models/mod.rs new file mode 100644 index 00000000..609bb902 --- /dev/null +++ b/radix-engine-toolkit/src/models/mod.rs @@ -0,0 +1,27 @@ +// 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 common; +pub mod cryptographic; +pub mod macros; +pub mod manifest; +pub mod olympia; +pub mod sbor; +pub mod scrypto; +pub mod traits; +pub mod transaction; +pub mod value; diff --git a/radix-engine-toolkit/src/models/olympia/mod.rs b/radix-engine-toolkit/src/models/olympia/mod.rs new file mode 100644 index 00000000..bfe3d0cb --- /dev/null +++ b/radix-engine-toolkit/src/models/olympia/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 network; diff --git a/radix-engine-toolkit/src/models/olympia/network.rs b/radix-engine-toolkit/src/models/olympia/network.rs new file mode 100644 index 00000000..93b0c3b9 --- /dev/null +++ b/radix-engine-toolkit/src/models/olympia/network.rs @@ -0,0 +1,64 @@ +// 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_core::functions::derive::OlympiaNetwork; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; + +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, Clone)] +pub enum SerializableOlympiaNetwork { + Mainnet, + Stokenet, + Releasenet, + RCNet, + Milestonenet, + Devopsnet, + Sandpitnet, + Localnet, +} + +impl From for SerializableOlympiaNetwork { + fn from(value: OlympiaNetwork) -> Self { + match value { + OlympiaNetwork::Mainnet => Self::Mainnet, + OlympiaNetwork::Stokenet => Self::Stokenet, + OlympiaNetwork::Releasenet => Self::Releasenet, + OlympiaNetwork::RCNet => Self::RCNet, + OlympiaNetwork::Milestonenet => Self::Milestonenet, + OlympiaNetwork::Devopsnet => Self::Devopsnet, + OlympiaNetwork::Sandpitnet => Self::Sandpitnet, + OlympiaNetwork::Localnet => Self::Localnet, + } + } +} + +impl From for OlympiaNetwork { + fn from(value: SerializableOlympiaNetwork) -> Self { + match value { + SerializableOlympiaNetwork::Mainnet => Self::Mainnet, + SerializableOlympiaNetwork::Stokenet => Self::Stokenet, + SerializableOlympiaNetwork::Releasenet => Self::Releasenet, + SerializableOlympiaNetwork::RCNet => Self::RCNet, + SerializableOlympiaNetwork::Milestonenet => Self::Milestonenet, + SerializableOlympiaNetwork::Devopsnet => Self::Devopsnet, + SerializableOlympiaNetwork::Sandpitnet => Self::Sandpitnet, + SerializableOlympiaNetwork::Localnet => Self::Localnet, + } + } +} diff --git a/radix-engine-toolkit/src/models/sbor/local_type_index.rs b/radix-engine-toolkit/src/models/sbor/local_type_index.rs new file mode 100644 index 00000000..3b021ac3 --- /dev/null +++ b/radix-engine-toolkit/src/models/sbor/local_type_index.rs @@ -0,0 +1,50 @@ +// 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::prelude::*; +use sbor::LocalTypeIndex; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind", content = "value")] +pub enum SerializableLocalTypeIndex { + WellKnown(SerializableU8), + SchemaLocalIndex(SerializableU64), +} + +impl From for SerializableLocalTypeIndex { + fn from(value: LocalTypeIndex) -> Self { + match value { + LocalTypeIndex::SchemaLocalIndex(value) => { + Self::SchemaLocalIndex((value as u64).into()) + } + LocalTypeIndex::WellKnown(value) => Self::WellKnown(value.into()), + } + } +} + +impl From for LocalTypeIndex { + fn from(value: SerializableLocalTypeIndex) -> Self { + match value { + SerializableLocalTypeIndex::SchemaLocalIndex(value) => { + Self::SchemaLocalIndex(*value as usize) + } + SerializableLocalTypeIndex::WellKnown(value) => Self::WellKnown(*value), + } + } +} diff --git a/radix-engine-toolkit/src/models/sbor/mod.rs b/radix-engine-toolkit/src/models/sbor/mod.rs new file mode 100644 index 00000000..2812783a --- /dev/null +++ b/radix-engine-toolkit/src/models/sbor/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 local_type_index; +pub mod serialization_mode; diff --git a/radix-engine-toolkit/src/models/sbor/serialization_mode.rs b/radix-engine-toolkit/src/models/sbor/serialization_mode.rs new file mode 100644 index 00000000..b67987d4 --- /dev/null +++ b/radix-engine-toolkit/src/models/sbor/serialization_mode.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 sbor::representations::SerializationMode; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub enum SerializableSerializationMode { + Programmatic, + Model, + Natural, +} + +impl From for SerializableSerializationMode { + fn from(value: SerializationMode) -> Self { + match value { + SerializationMode::Model => Self::Model, + SerializationMode::Natural => Self::Natural, + SerializationMode::Programmatic => Self::Programmatic, + } + } +} + +impl From for SerializationMode { + fn from(value: SerializableSerializationMode) -> Self { + match value { + SerializableSerializationMode::Model => Self::Model, + SerializableSerializationMode::Natural => Self::Natural, + SerializableSerializationMode::Programmatic => Self::Programmatic, + } + } +} diff --git a/radix-engine-toolkit/src/models/scrypto/mod.rs b/radix-engine-toolkit/src/models/scrypto/mod.rs new file mode 100644 index 00000000..8fc8802a --- /dev/null +++ b/radix-engine-toolkit/src/models/scrypto/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 node_id; +pub mod non_fungible_global_id; diff --git a/radix-engine-toolkit/src/models/scrypto/node_id.rs b/radix-engine-toolkit/src/models/scrypto/node_id.rs new file mode 100644 index 00000000..c5bce11b --- /dev/null +++ b/radix-engine-toolkit/src/models/scrypto/node_id.rs @@ -0,0 +1,121 @@ +// 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::prelude::{ + AddressBech32DecodeError, AddressBech32Decoder, AddressBech32Encoder, +}; +use schemars::JsonSchema; +use scrypto::prelude::*; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; + +#[serde_as] +#[derive( + Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, +)] +#[serde(transparent)] +#[schemars(transparent)] +pub struct SerializableNodeId( + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub SerializableNodeIdInternal, +); + +impl SerializableNodeId { + pub fn new(node_id: NodeId, network_id: u8) -> Self { + Self(SerializableNodeIdInternal { + node_id, + network_id, + }) + } + + pub fn from_global_address>(address: G, network_id: u8) -> Self { + let global_address: GlobalAddress = address.into(); + let node_id = global_address.as_node_id(); + Self::new(*node_id, network_id) + } +} + +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct SerializableNodeIdInternal { + pub node_id: NodeId, + pub network_id: u8, +} + +impl Display for SerializableNodeIdInternal { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let network_definition = + radix_engine_toolkit_core::utils::network_definition_from_network_id(self.network_id); + let bech32_encoder = AddressBech32Encoder::new(&network_definition); + let string = bech32_encoder + .encode(&self.node_id.0) + .map_err(|_| fmt::Error)?; + write!(f, "{}", string) + } +} + +impl FromStr for SerializableNodeIdInternal { + type Err = SerializableNodeIdError; + + fn from_str(s: &str) -> Result { + let network_id = radix_engine_toolkit_core::utils::network_id_from_address_string(s) + .map_or( + Err(SerializableNodeIdError::FailedToParseStringAsAddress( + s.to_owned(), + )), + Ok, + )?; + + let network_definition = + radix_engine_toolkit_core::utils::network_definition_from_network_id(network_id); + let bech32_decoder = AddressBech32Decoder::new(&network_definition); + let (_, data) = bech32_decoder.validate_and_decode(s)?; + + data.try_into() + .map_err(|_| SerializableNodeIdError::InvalidAddressLength) + .map(|node_id| Self { + network_id, + node_id: NodeId(node_id), + }) + } +} + +impl AsRef for SerializableNodeIdInternal { + fn as_ref(&self) -> &NodeId { + &self.node_id + } +} + +#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema)] +#[serde(tag = "kind", content = "error")] +pub enum SerializableNodeIdError { + FailedToParseStringAsAddress(String), + Bech32DecodingError(String), + InvalidAddressLength, +} + +impl From for SerializableNodeIdError { + fn from(value: AddressBech32DecodeError) -> Self { + Self::Bech32DecodingError(format!("{:?}", value)) + } +} + +impl Display for SerializableNodeIdError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + Debug::fmt(&self, f) + } +} diff --git a/radix-engine-toolkit/src/models/scrypto/non_fungible_global_id.rs b/radix-engine-toolkit/src/models/scrypto/non_fungible_global_id.rs new file mode 100644 index 00000000..de5fc5a0 --- /dev/null +++ b/radix-engine-toolkit/src/models/scrypto/non_fungible_global_id.rs @@ -0,0 +1,109 @@ +// 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::prelude::*; + +use radix_engine_common::prelude::{AddressBech32Decoder, AddressBech32Encoder}; +use radix_engine_toolkit_core::utils::network_definition_from_network_id; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; +use std::fmt::{Debug, Display}; +use std::str::FromStr; +use transaction::prelude::NonFungibleGlobalId; + +#[serde_as] +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(transparent)] +#[schemars(transparent)] +pub struct SerializableNonFungibleGlobalId( + #[schemars(with = "String")] + #[serde_as(as = "serde_with::DisplayFromStr")] + pub SerializableNonFungibleGlobalIdInternal, +); + +impl SerializableNonFungibleGlobalId { + pub fn new(id: NonFungibleGlobalId, network_id: u8) -> Self { + Self(SerializableNonFungibleGlobalIdInternal { + non_fungible_global_id: id, + network_id, + }) + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct SerializableNonFungibleGlobalIdInternal { + pub non_fungible_global_id: NonFungibleGlobalId, + pub network_id: u8, +} + +impl Display for SerializableNonFungibleGlobalIdInternal { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let network_definition = network_definition_from_network_id(self.network_id); + let bech32_encoder = AddressBech32Encoder::new(&network_definition); + write!( + f, + "{}", + self.non_fungible_global_id + .to_canonical_string(&bech32_encoder) + ) + } +} + +impl FromStr for SerializableNonFungibleGlobalIdInternal { + type Err = SerializableNonFungibleGlobalIdError; + + fn from_str(s: &str) -> Result { + let resource_address_string = + s.split(':') + .next() + .ok_or(SerializableNonFungibleGlobalIdError::NoSeparatorFound( + s.to_owned(), + ))?; + + let network_id = radix_engine_toolkit_core::utils::network_id_from_address_string( + resource_address_string, + ) + .ok_or(SerializableNonFungibleGlobalIdError::InvalidResourceAddress)?; + let network_definition = network_definition_from_network_id(network_id); + let bech32_decoder = AddressBech32Decoder::new(&network_definition); + + let non_fungible_global_id = + NonFungibleGlobalId::try_from_canonical_string(&bech32_decoder, s).map_err( + |error| SerializableNonFungibleGlobalIdError::ParsingError(debug_string(error)), + )?; + + Ok(SerializableNonFungibleGlobalIdInternal { + non_fungible_global_id, + network_id, + }) + } +} + +#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema)] +#[serde(tag = "kind", content = "error")] +pub enum SerializableNonFungibleGlobalIdError { + NoSeparatorFound(String), + InvalidResourceAddress, + ParsingError(String), +} + +impl Display for SerializableNonFungibleGlobalIdError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + Debug::fmt(&self, f) + } +} diff --git a/radix-engine-toolkit/build.rs b/radix-engine-toolkit/src/models/traits.rs similarity index 71% rename from radix-engine-toolkit/build.rs rename to radix-engine-toolkit/src/models/traits.rs index acd539ef..fef58625 100644 --- a/radix-engine-toolkit/build.rs +++ b/radix-engine-toolkit/src/models/traits.rs @@ -15,14 +15,19 @@ // specific language governing permissions and limitations // under the License. -use std::process::Command; +pub trait NativeConvertible +where + Self: Sized, +{ + type Native; + type Error; + type Context; -fn main() { - // note: add error checking yourself. - let output = Command::new("git") - .args(["rev-parse", "HEAD"]) - .output() - .unwrap(); - let last_commit_hash = String::from_utf8(output.stdout).unwrap(); - println!("cargo:rustc-env=GIT_HASH={}", last_commit_hash); + fn to_native(&self, network_id: u8) -> Result; + + fn from_native( + native: &Self::Native, + network_id: u8, + context: Self::Context, + ) -> Result; } diff --git a/radix-engine-toolkit/src/models/transaction/header.rs b/radix-engine-toolkit/src/models/transaction/header.rs new file mode 100644 index 00000000..d152be81 --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/header.rs @@ -0,0 +1,64 @@ +// 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::types::Epoch; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::prelude::TransactionHeaderV1; + +use crate::prelude::*; + +type SerializableEpoch = SerializableU64; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SerializableTransactionHeader { + pub network_id: SerializableU8, + pub start_epoch_inclusive: SerializableEpoch, + pub end_epoch_exclusive: SerializableEpoch, + pub nonce: SerializableU32, + pub notary_public_key: SerializablePublicKey, + pub notary_is_signatory: bool, + pub tip_percentage: SerializableU16, +} + +impl From for TransactionHeaderV1 { + fn from(value: SerializableTransactionHeader) -> Self { + Self { + network_id: *value.network_id, + start_epoch_inclusive: Epoch::of(*value.start_epoch_inclusive), + end_epoch_exclusive: Epoch::of(*value.end_epoch_exclusive), + nonce: *value.nonce, + notary_public_key: value.notary_public_key.into(), + notary_is_signatory: value.notary_is_signatory, + tip_percentage: *value.tip_percentage, + } + } +} + +impl From for SerializableTransactionHeader { + fn from(value: TransactionHeaderV1) -> Self { + Self { + network_id: value.network_id.into(), + start_epoch_inclusive: value.start_epoch_inclusive.number().into(), + end_epoch_exclusive: value.end_epoch_exclusive.number().into(), + nonce: value.nonce.into(), + notary_public_key: value.notary_public_key.into(), + notary_is_signatory: value.notary_is_signatory, + tip_percentage: value.tip_percentage.into(), + } + } +} diff --git a/radix-engine-toolkit/src/models/transaction/instruction.rs b/radix-engine-toolkit/src/models/transaction/instruction.rs new file mode 100644 index 00000000..291ac1dd --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/instruction.rs @@ -0,0 +1,652 @@ +// 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::prelude::*; + +use radix_engine::types::*; +use schemars::*; +use serde::*; +use transaction::prelude::*; +use transaction::validation::*; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, Hash)] +#[serde(tag = "kind")] +pub enum SerializableInstruction { + TakeAllFromWorktop { + resource_address: SerializableManifestValue, + new_bucket: SerializableManifestValue, + }, + + TakeFromWorktop { + resource_address: SerializableManifestValue, + amount: SerializableManifestValue, + new_bucket: SerializableManifestValue, + }, + + TakeNonFungiblesFromWorktop { + resource_address: SerializableManifestValue, + ids: SerializableManifestValue, + new_bucket: SerializableManifestValue, + }, + + ReturnToWorktop { + bucket_id: SerializableManifestValue, + }, + + AssertWorktopContainsAny { + resource_address: SerializableManifestValue, + }, + + AssertWorktopContains { + resource_address: SerializableManifestValue, + amount: SerializableManifestValue, + }, + + AssertWorktopContainsNonFungibles { + resource_address: SerializableManifestValue, + ids: SerializableManifestValue, + }, + + PopFromAuthZone { + new_proof: SerializableManifestValue, + }, + + PushToAuthZone { + proof_id: SerializableManifestValue, + }, + + ClearAuthZone, + + CreateProofFromAuthZoneOfAmount { + resource_address: SerializableManifestValue, + amount: SerializableManifestValue, + new_proof: SerializableManifestValue, + }, + + CreateProofFromAuthZoneOfNonFungibles { + resource_address: SerializableManifestValue, + ids: SerializableManifestValue, + new_proof: SerializableManifestValue, + }, + + CreateProofFromAuthZoneOfAll { + resource_address: SerializableManifestValue, + new_proof: SerializableManifestValue, + }, + + ClearSignatureProofs, + + CreateProofFromBucketOfAmount { + bucket_id: SerializableManifestValue, + amount: SerializableManifestValue, + new_proof: SerializableManifestValue, + }, + + CreateProofFromBucketOfNonFungibles { + bucket_id: SerializableManifestValue, + ids: SerializableManifestValue, + new_proof: SerializableManifestValue, + }, + + CreateProofFromBucketOfAll { + bucket_id: SerializableManifestValue, + new_proof: SerializableManifestValue, + }, + + BurnResource { + bucket_id: SerializableManifestValue, + }, + + CloneProof { + proof_id: SerializableManifestValue, + new_proof: SerializableManifestValue, + }, + + DropProof { + proof_id: SerializableManifestValue, + }, + + CallFunction { + package_address: SerializableManifestValue, + blueprint_name: SerializableManifestValue, + function_name: SerializableManifestValue, + args: SerializableManifestValue, + }, + + CallMethod { + address: SerializableManifestValue, + method_name: SerializableManifestValue, + args: SerializableManifestValue, + }, + + CallRoyaltyMethod { + address: SerializableManifestValue, + method_name: SerializableManifestValue, + args: SerializableManifestValue, + }, + + CallMetadataMethod { + address: SerializableManifestValue, + method_name: SerializableManifestValue, + args: SerializableManifestValue, + }, + + CallAccessRulesMethod { + address: SerializableManifestValue, + method_name: SerializableManifestValue, + args: SerializableManifestValue, + }, + + CallDirectVaultMethod { + address: SerializableManifestValue, + method_name: SerializableManifestValue, + args: SerializableManifestValue, + }, + + DropAllProofs, + + AllocateGlobalAddress { + package_address: SerializableManifestValue, + blueprint_name: SerializableManifestValue, + address_reservation: SerializableManifestValue, + named_address: SerializableManifestValue, + }, +} + +impl SerializableInstruction { + pub fn from_instruction( + instruction: &InstructionV1, + network_id: u8, + id_allocator: &mut ManifestIdAllocator, + ) -> Result { + let instruction = match instruction { + InstructionV1::TakeFromWorktop { + resource_address, + amount, + } => { + let bucket = id_allocator.new_bucket_id(); + + Self::TakeFromWorktop { + resource_address: SerializableManifestValue::from_typed( + resource_address, + network_id, + )?, + amount: SerializableManifestValue::from_typed(amount, network_id)?, + new_bucket: SerializableManifestValue::from_typed(&bucket, network_id)?, + } + } + InstructionV1::TakeNonFungiblesFromWorktop { + resource_address, + ids, + } => { + let bucket = id_allocator.new_bucket_id(); + + Self::TakeNonFungiblesFromWorktop { + ids: SerializableManifestValue::from_typed(ids, network_id)?, + resource_address: SerializableManifestValue::from_typed( + resource_address, + network_id, + )?, + new_bucket: SerializableManifestValue::from_typed(&bucket, network_id)?, + } + } + InstructionV1::TakeAllFromWorktop { resource_address } => { + let bucket = id_allocator.new_bucket_id(); + + Self::TakeAllFromWorktop { + resource_address: SerializableManifestValue::from_typed( + resource_address, + network_id, + )?, + new_bucket: SerializableManifestValue::from_typed(&bucket, network_id)?, + } + } + InstructionV1::ReturnToWorktop { bucket_id } => Self::ReturnToWorktop { + bucket_id: SerializableManifestValue::from_typed(&bucket_id, network_id)?, + }, + InstructionV1::AssertWorktopContains { + resource_address, + amount, + } => Self::AssertWorktopContains { + resource_address: SerializableManifestValue::from_typed( + resource_address, + network_id, + )?, + amount: SerializableManifestValue::from_typed(amount, network_id)?, + }, + InstructionV1::AssertWorktopContainsAny { resource_address } => { + Self::AssertWorktopContainsAny { + resource_address: SerializableManifestValue::from_typed( + resource_address, + network_id, + )?, + } + } + InstructionV1::AssertWorktopContainsNonFungibles { + resource_address, + ids, + } => Self::AssertWorktopContainsNonFungibles { + resource_address: SerializableManifestValue::from_typed( + resource_address, + network_id, + )?, + ids: SerializableManifestValue::from_typed(ids, network_id)?, + }, + InstructionV1::PopFromAuthZone => { + let proof = id_allocator.new_proof_id(); + + Self::PopFromAuthZone { + new_proof: SerializableManifestValue::from_typed(&proof, network_id)?, + } + } + InstructionV1::PushToAuthZone { proof_id } => Self::PushToAuthZone { + proof_id: SerializableManifestValue::from_typed(&proof_id, network_id)?, + }, + InstructionV1::ClearAuthZone => Self::ClearAuthZone, + InstructionV1::CreateProofFromAuthZoneOfAll { resource_address } => { + let proof = id_allocator.new_proof_id(); + + Self::CreateProofFromAuthZoneOfAll { + resource_address: SerializableManifestValue::from_typed( + resource_address, + network_id, + )?, + new_proof: SerializableManifestValue::from_typed(&proof, network_id)?, + } + } + InstructionV1::CreateProofFromAuthZoneOfAmount { + amount, + resource_address, + } => { + let proof = id_allocator.new_proof_id(); + + Self::CreateProofFromAuthZoneOfAmount { + resource_address: SerializableManifestValue::from_typed( + resource_address, + network_id, + )?, + amount: SerializableManifestValue::from_typed(amount, network_id)?, + new_proof: SerializableManifestValue::from_typed(&proof, network_id)?, + } + } + InstructionV1::CreateProofFromAuthZoneOfNonFungibles { + ids, + resource_address, + } => { + let proof = id_allocator.new_proof_id(); + + Self::CreateProofFromAuthZoneOfNonFungibles { + resource_address: SerializableManifestValue::from_typed( + resource_address, + network_id, + )?, + ids: SerializableManifestValue::from_typed(ids, network_id)?, + new_proof: SerializableManifestValue::from_typed(&proof, network_id)?, + } + } + InstructionV1::ClearSignatureProofs => Self::ClearSignatureProofs, + InstructionV1::CreateProofFromBucketOfAll { bucket_id } => { + let proof = id_allocator.new_proof_id(); + + Self::CreateProofFromBucketOfAll { + bucket_id: SerializableManifestValue::from_typed(bucket_id, network_id)?, + new_proof: SerializableManifestValue::from_typed(&proof, network_id)?, + } + } + InstructionV1::CreateProofFromBucketOfAmount { amount, bucket_id } => { + let proof = id_allocator.new_proof_id(); + + Self::CreateProofFromBucketOfAmount { + bucket_id: SerializableManifestValue::from_typed(bucket_id, network_id)?, + amount: SerializableManifestValue::from_typed(amount, network_id)?, + new_proof: SerializableManifestValue::from_typed(&proof, network_id)?, + } + } + InstructionV1::CreateProofFromBucketOfNonFungibles { ids, bucket_id } => { + let proof = id_allocator.new_proof_id(); + + Self::CreateProofFromBucketOfNonFungibles { + bucket_id: SerializableManifestValue::from_typed(bucket_id, network_id)?, + ids: SerializableManifestValue::from_typed(ids, network_id)?, + new_proof: SerializableManifestValue::from_typed(&proof, network_id)?, + } + } + InstructionV1::BurnResource { bucket_id } => Self::BurnResource { + bucket_id: SerializableManifestValue::from_typed(bucket_id, network_id)?, + }, + InstructionV1::CloneProof { proof_id } => { + let proof = id_allocator.new_proof_id(); + + Self::CloneProof { + proof_id: SerializableManifestValue::from_typed(proof_id, network_id)?, + new_proof: SerializableManifestValue::from_typed(&proof, network_id)?, + } + } + InstructionV1::DropProof { proof_id } => Self::DropProof { + proof_id: SerializableManifestValue::from_typed(proof_id, network_id)?, + }, + InstructionV1::DropAllProofs => Self::DropAllProofs, + InstructionV1::CallFunction { + package_address, + blueprint_name, + function_name, + args, + } => Self::CallFunction { + package_address: SerializableManifestValue::from_typed( + package_address, + network_id, + )?, + blueprint_name: SerializableManifestValue::from_typed(blueprint_name, network_id)?, + function_name: SerializableManifestValue::from_typed(function_name, network_id)?, + args: SerializableManifestValue::from_typed(args, network_id)?, + }, + InstructionV1::CallMethod { + address, + method_name, + args, + } => Self::CallMethod { + address: SerializableManifestValue::from_typed(address, network_id)?, + method_name: SerializableManifestValue::from_typed(method_name, network_id)?, + args: SerializableManifestValue::from_typed(args, network_id)?, + }, + InstructionV1::CallRoyaltyMethod { + address, + method_name, + args, + } => Self::CallRoyaltyMethod { + address: SerializableManifestValue::from_typed(address, network_id)?, + method_name: SerializableManifestValue::from_typed(method_name, network_id)?, + args: SerializableManifestValue::from_typed(args, network_id)?, + }, + InstructionV1::CallMetadataMethod { + address, + method_name, + args, + } => Self::CallMetadataMethod { + address: SerializableManifestValue::from_typed(address, network_id)?, + method_name: SerializableManifestValue::from_typed(method_name, network_id)?, + args: SerializableManifestValue::from_typed(args, network_id)?, + }, + InstructionV1::CallAccessRulesMethod { + address, + method_name, + args, + } => Self::CallAccessRulesMethod { + address: SerializableManifestValue::from_typed(address, network_id)?, + method_name: SerializableManifestValue::from_typed(method_name, network_id)?, + args: SerializableManifestValue::from_typed(args, network_id)?, + }, + InstructionV1::CallDirectVaultMethod { + address, + method_name, + args, + } => Self::CallDirectVaultMethod { + address: SerializableManifestValue::from_typed(address, network_id)?, + method_name: SerializableManifestValue::from_typed(method_name, network_id)?, + args: SerializableManifestValue::from_typed(args, network_id)?, + }, + InstructionV1::AllocateGlobalAddress { + package_address, + blueprint_name, + } => { + let address_reservation = id_allocator.new_address_reservation_id(); + let named_address = id_allocator.new_address_id(); + + Self::AllocateGlobalAddress { + package_address: SerializableManifestValue::from_typed( + package_address, + network_id, + )?, + blueprint_name: SerializableManifestValue::from_typed( + blueprint_name, + network_id, + )?, + address_reservation: SerializableManifestValue::from_typed( + &address_reservation, + network_id, + )?, + named_address: SerializableManifestValue::from_typed( + &named_address, + network_id, + )?, + } + } + }; + Ok(instruction) + } + + pub fn to_instruction(&self) -> Result { + let instruction = match self { + Self::TakeFromWorktop { + resource_address, + amount, + .. + } => InstructionV1::TakeFromWorktop { + resource_address: resource_address.to_typed()?, + amount: amount.to_typed()?, + }, + Self::TakeNonFungiblesFromWorktop { + ids, + resource_address, + .. + } => InstructionV1::TakeNonFungiblesFromWorktop { + resource_address: resource_address.to_typed()?, + ids: ids.to_typed()?, + }, + Self::TakeAllFromWorktop { + resource_address, .. + } => InstructionV1::TakeAllFromWorktop { + resource_address: resource_address.to_typed()?, + }, + Self::ReturnToWorktop { bucket_id } => InstructionV1::ReturnToWorktop { + bucket_id: bucket_id.to_typed()?, + }, + Self::AssertWorktopContains { + resource_address, + amount, + } => InstructionV1::AssertWorktopContains { + resource_address: resource_address.to_typed()?, + amount: amount.to_typed()?, + }, + Self::AssertWorktopContainsAny { resource_address } => { + InstructionV1::AssertWorktopContainsAny { + resource_address: resource_address.to_typed()?, + } + } + Self::AssertWorktopContainsNonFungibles { + resource_address, + ids, + } => InstructionV1::AssertWorktopContainsNonFungibles { + resource_address: resource_address.to_typed()?, + ids: ids.to_typed()?, + }, + Self::PopFromAuthZone { .. } => InstructionV1::PopFromAuthZone {}, + Self::PushToAuthZone { proof_id } => InstructionV1::PushToAuthZone { + proof_id: proof_id.to_typed()?, + }, + Self::ClearAuthZone => InstructionV1::ClearAuthZone, + Self::ClearSignatureProofs => InstructionV1::ClearSignatureProofs, + Self::CreateProofFromAuthZoneOfAll { + resource_address, .. + } => InstructionV1::CreateProofFromAuthZoneOfAll { + resource_address: resource_address.to_typed()?, + }, + Self::CreateProofFromAuthZoneOfAmount { + resource_address, + amount, + .. + } => InstructionV1::CreateProofFromAuthZoneOfAmount { + resource_address: resource_address.to_typed()?, + amount: amount.to_typed()?, + }, + Self::CreateProofFromAuthZoneOfNonFungibles { + resource_address, + ids, + .. + } => InstructionV1::CreateProofFromAuthZoneOfNonFungibles { + resource_address: resource_address.to_typed()?, + ids: ids.to_typed()?, + }, + Self::CreateProofFromBucketOfAll { bucket_id, .. } => { + InstructionV1::CreateProofFromBucketOfAll { + bucket_id: bucket_id.to_typed()?, + } + } + Self::CreateProofFromBucketOfAmount { + bucket_id, amount, .. + } => InstructionV1::CreateProofFromBucketOfAmount { + bucket_id: bucket_id.to_typed()?, + amount: amount.to_typed()?, + }, + Self::CreateProofFromBucketOfNonFungibles { bucket_id, ids, .. } => { + InstructionV1::CreateProofFromBucketOfNonFungibles { + bucket_id: bucket_id.to_typed()?, + ids: ids.to_typed()?, + } + } + Self::BurnResource { bucket_id } => InstructionV1::BurnResource { + bucket_id: bucket_id.to_typed()?, + }, + Self::CloneProof { proof_id, .. } => InstructionV1::CloneProof { + proof_id: proof_id.to_typed()?, + }, + Self::DropProof { proof_id, .. } => InstructionV1::DropProof { + proof_id: proof_id.to_typed()?, + }, + Self::DropAllProofs {} => InstructionV1::DropAllProofs {}, + Self::CallFunction { + package_address, + blueprint_name, + function_name, + args, + } => InstructionV1::CallFunction { + package_address: package_address.to_typed()?, + blueprint_name: blueprint_name.to_typed()?, + function_name: function_name.to_typed()?, + args: args.to_typed()?, + }, + Self::CallMethod { + address, + method_name, + args, + } => InstructionV1::CallMethod { + address: address.to_typed()?, + method_name: method_name.to_typed()?, + args: args.to_typed()?, + }, + Self::CallRoyaltyMethod { + address, + method_name, + args, + } => InstructionV1::CallRoyaltyMethod { + address: address.to_typed()?, + method_name: method_name.to_typed()?, + args: args.to_typed()?, + }, + Self::CallMetadataMethod { + address, + method_name, + args, + } => InstructionV1::CallMetadataMethod { + address: address.to_typed()?, + method_name: method_name.to_typed()?, + args: args.to_typed()?, + }, + Self::CallAccessRulesMethod { + address, + method_name, + args, + } => InstructionV1::CallAccessRulesMethod { + address: address.to_typed()?, + method_name: method_name.to_typed()?, + args: args.to_typed()?, + }, + Self::CallDirectVaultMethod { + address, + method_name, + args, + } => InstructionV1::CallDirectVaultMethod { + address: address.to_typed()?, + method_name: method_name.to_typed()?, + args: args.to_typed()?, + }, + Self::AllocateGlobalAddress { + package_address, + blueprint_name, + .. + } => InstructionV1::AllocateGlobalAddress { + package_address: package_address.to_typed()?, + blueprint_name: blueprint_name.to_typed()?, + }, + }; + Ok(instruction) + } +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone)] +#[serde(tag = "kind", content = "error")] +pub enum InstructionConversionError { + ValueConversionError(ValueConversionError), +} + +impl From for InstructionConversionError { + fn from(value: ValueConversionError) -> Self { + Self::ValueConversionError(value) + } +} + +pub fn to_serializable_instructions( + instructions: &[InstructionV1], + network_id: u8, +) -> Result, LocatedInstructionConversionError> { + let mut id_allocator = ManifestIdAllocator::default(); + + instructions + .iter() + .enumerate() + .map(|(instruction_index, instruction)| { + SerializableInstruction::from_instruction(instruction, network_id, &mut id_allocator) + .map_err(|error| LocatedInstructionConversionError { + instruction_index, + error, + }) + }) + .collect::>() +} + +pub fn to_native_instructions( + instructions: &[SerializableInstruction], +) -> Result, LocatedInstructionConversionError> { + instructions + .iter() + .enumerate() + .map(|(instruction_index, instruction)| { + instruction + .to_instruction() + .map_err(|error| LocatedInstructionConversionError { + instruction_index, + error, + }) + }) + .collect::>() +} + +#[derive(Debug, Clone)] +pub struct LocatedInstructionConversionError { + pub instruction_index: usize, + pub error: InstructionConversionError, +} diff --git a/radix-engine-toolkit/src/models/transaction/instructions.rs b/radix-engine-toolkit/src/models/transaction/instructions.rs new file mode 100644 index 00000000..2a7b5029 --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/instructions.rs @@ -0,0 +1,149 @@ +// 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::prelude::*; + +use radix_engine_toolkit_core::utils::*; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::manifest::*; +use transaction::prelude::*; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind", content = "value")] +pub enum SerializableInstructions { + String(String), + Parsed(Vec), +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub enum SerializableInstructionsKind { + String, + Parsed, +} + +impl SerializableInstructions { + pub fn new( + instructions: &[InstructionV1], + kind: SerializableInstructionsKind, + network_id: u8, + ) -> Result { + match kind { + SerializableInstructionsKind::String => { + let network_definition = network_definition_from_network_id(network_id); + let string = transaction::manifest::decompile(instructions, &network_definition)?; + Ok(Self::String(string)) + } + SerializableInstructionsKind::Parsed => { + let instructions = to_serializable_instructions(instructions, network_id)?; + Ok(Self::Parsed(instructions)) + } + } + } + + pub fn to_instructions( + &self, + network_id: u8, + ) -> Result, SerializableInstructionsError> { + match self { + Self::String(string) => transaction::manifest::compile( + string, + &network_definition_from_network_id(network_id), + MockBlobProvider::new(), + ) + .map_err(SerializableInstructionsError::from) + .map(|manifest| manifest.instructions), + Self::Parsed(parsed) => { + to_native_instructions(parsed).map_err(SerializableInstructionsError::from) + } + } + } + + pub fn convert_serializable_instructions_kind( + &mut self, + to_type: SerializableInstructionsKind, + network_id: u8, + ) -> Result<(), SerializableInstructionsError> { + match (&self, to_type) { + (Self::String(..), SerializableInstructionsKind::String) + | (Self::Parsed(..), SerializableInstructionsKind::Parsed) => Ok(()), + (Self::Parsed(parsed), SerializableInstructionsKind::String) => { + let instructions = to_native_instructions(parsed)?; + let string = decompile( + &instructions, + &network_definition_from_network_id(network_id), + )?; + *self = Self::String(string); + Ok(()) + } + (Self::String(string), SerializableInstructionsKind::Parsed) => { + let instructions = transaction::manifest::compile( + string, + &network_definition_from_network_id(network_id), + MockBlobProvider::new(), + ) + .map(|manifest| manifest.instructions)?; + let instructions = to_serializable_instructions(&instructions, network_id)?; + *self = Self::Parsed(instructions); + Ok(()) + } + } + } +} + +#[derive(Debug, Clone)] +pub enum SerializableInstructionsError { + CompilationError(String), + DecompilationError(String), + LocatedInstructionConversionError(LocatedInstructionConversionError), +} + +impl From for SerializableInstructionsError { + fn from(value: CompileError) -> Self { + Self::CompilationError(format!("{value:?}")) + } +} + +impl From for SerializableInstructionsError { + fn from(value: DecompileError) -> Self { + Self::CompilationError(format!("{value:?}")) + } +} + +impl From for SerializableInstructionsError { + fn from(value: LocatedInstructionConversionError) -> Self { + Self::LocatedInstructionConversionError(value) + } +} + +impl NativeConvertible for SerializableInstructions { + type Native = Vec; + type Error = SerializableInstructionsError; + type Context = SerializableInstructionsKind; + + fn to_native(&self, network_id: u8) -> Result { + self.to_instructions(network_id) + } + + fn from_native( + native: &Self::Native, + network_id: u8, + instructions_kind: Self::Context, + ) -> Result { + Self::new(native, instructions_kind, network_id) + } +} diff --git a/radix-engine-toolkit/src/models/transaction/intent.rs b/radix-engine-toolkit/src/models/transaction/intent.rs new file mode 100644 index 00000000..83a826f7 --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/intent.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 schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::prelude::*; + +use crate::prelude::*; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SerializableIntent { + pub header: SerializableTransactionHeader, + pub manifest: SerializableTransactionManifest, + pub message: SerializableMessage, +} + +impl NativeConvertible for SerializableIntent { + type Native = IntentV1; + type Error = SerializableInstructionsError; + type Context = SerializableInstructionsKind; + + fn to_native(&self, network_id: u8) -> Result { + let header = self.header.clone().into(); + let TransactionManifestV1 { + instructions, + blobs, + } = self.manifest.to_native(network_id)?; + let message = self.message.clone().into(); + + Ok(IntentV1 { + header, + instructions: InstructionsV1(instructions), + blobs: BlobsV1 { + blobs: blobs.into_values().map(BlobV1).collect(), + }, + message, + }) + } + + fn from_native( + native: &Self::Native, + network_id: u8, + context: Self::Context, + ) -> Result { + let instructions = + SerializableInstructions::from_native(&native.instructions.0, network_id, context)?; + let blobs = native + .blobs + .blobs + .clone() + .into_iter() + .map(|blob| blob.0.into()) + .collect(); + let message = native.message.clone().into(); + + let manifest = SerializableTransactionManifest { + instructions, + blobs, + }; + let header = native.header.clone().into(); + + Ok(Self { + manifest, + header, + message, + }) + } +} diff --git a/radix-engine-toolkit/src/models/transaction/manifest.rs b/radix-engine-toolkit/src/models/transaction/manifest.rs new file mode 100644 index 00000000..27a1975e --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/manifest.rs @@ -0,0 +1,68 @@ +// 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::ops::Deref; + +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::prelude::TransactionManifestV1; + +use crate::prelude::*; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SerializableTransactionManifest { + pub instructions: SerializableInstructions, + pub blobs: Vec, +} + +impl NativeConvertible for SerializableTransactionManifest { + type Native = TransactionManifestV1; + type Error = SerializableInstructionsError; + type Context = SerializableInstructionsKind; + + fn to_native(&self, network_id: u8) -> Result { + let instructions = self.instructions.to_instructions(network_id)?; + let blobs = self + .blobs + .iter() + .map(|value| (scrypto::prelude::hash(&**value), value.deref().clone())) + .collect(); + + Ok(TransactionManifestV1 { + instructions, + blobs, + }) + } + + fn from_native( + native: &Self::Native, + network_id: u8, + instructions_kind: Self::Context, + ) -> Result { + let instructions = SerializableInstructions::from_native( + &native.instructions, + network_id, + instructions_kind, + )?; + let blobs = native.blobs.values().cloned().map(Into::into).collect(); + + Ok(Self { + instructions, + blobs, + }) + } +} diff --git a/radix-engine-toolkit/src/models/transaction/message.rs b/radix-engine-toolkit/src/models/transaction/message.rs new file mode 100644 index 00000000..2585a8d4 --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/message.rs @@ -0,0 +1,249 @@ +// 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::{hash::Hash, ops::Deref}; + +use ::indexmap::IndexMap; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::prelude::{ + AesGcmPayload, AesWrapped128BitKey, CurveType, DecryptorsByCurve, EncryptedMessageV1, + MessageContentsV1, MessageV1, PlaintextMessageV1, PublicKeyFingerprint, +}; + +use crate::prelude::*; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +#[serde(tag = "kind", content = "value")] +pub enum SerializableMessage { + None, + PlainText(SerializablePlainTextMessage), + Encrypted(SerializableEncryptedMessage), +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, Hash)] +pub struct SerializablePlainTextMessage { + pub mime_type: String, + pub message: SerializableMessageContent, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, Hash)] +#[serde(tag = "kind", content = "value")] +pub enum SerializableMessageContent { + String(String), + Bytes(SerializableBytes), +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SerializableEncryptedMessage { + pub encrypted: SerializableBytes, + pub decryptors_by_curve: IndexMap, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq, Hash)] +pub enum SerializableCurveType { + Ed25519, + Secp256k1, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub enum SerializableDecryptorsByCurve { + Ed25519 { + dh_ephemeral_public_key: SerializableEd25519PublicKey, + decryptors: IndexMap, + }, + Secp256k1 { + dh_ephemeral_public_key: SerializableSecp256k1PublicKey, + decryptors: IndexMap, + }, +} + +pub type SerializableAesWrapped128BitKey = AsHex<[u8; AesWrapped128BitKey::LENGTH]>; +pub type SerializablePublicKeyFingerprint = AsHex<[u8; PublicKeyFingerprint::LENGTH]>; + +//================== +// From Trait Impls +//================== + +impl From for MessageV1 { + fn from(value: SerializableMessage) -> Self { + match value { + SerializableMessage::None => Self::None, + SerializableMessage::Encrypted(value) => Self::Encrypted(value.into()), + SerializableMessage::PlainText(value) => Self::Plaintext(value.into()), + } + } +} + +impl From for SerializableMessage { + fn from(value: MessageV1) -> Self { + match value { + MessageV1::None => Self::None, + MessageV1::Encrypted(value) => Self::Encrypted(value.into()), + MessageV1::Plaintext(value) => Self::PlainText(value.into()), + } + } +} + +impl From for PlaintextMessageV1 { + fn from(value: SerializablePlainTextMessage) -> Self { + Self { + message: value.message.into(), + mime_type: value.mime_type, + } + } +} + +impl From for SerializablePlainTextMessage { + fn from(value: PlaintextMessageV1) -> Self { + Self { + message: value.message.into(), + mime_type: value.mime_type, + } + } +} + +impl From for MessageContentsV1 { + fn from(value: SerializableMessageContent) -> Self { + match value { + SerializableMessageContent::Bytes(value) => { + MessageContentsV1::Bytes(value.deref().clone()) + } + SerializableMessageContent::String(value) => MessageContentsV1::String(value), + } + } +} + +impl From for SerializableMessageContent { + fn from(value: MessageContentsV1) -> Self { + match value { + MessageContentsV1::Bytes(value) => Self::Bytes(value.into()), + MessageContentsV1::String(value) => Self::String(value), + } + } +} + +impl From for EncryptedMessageV1 { + fn from(value: SerializableEncryptedMessage) -> Self { + Self { + encrypted: AesGcmPayload(value.encrypted.deref().clone()), + decryptors_by_curve: map_into!(value.decryptors_by_curve), + } + } +} + +impl From for SerializableEncryptedMessage { + fn from(value: EncryptedMessageV1) -> Self { + Self { + encrypted: value.encrypted.0.into(), + decryptors_by_curve: map_into!(value.decryptors_by_curve), + } + } +} + +impl From for CurveType { + fn from(value: SerializableCurveType) -> Self { + match value { + SerializableCurveType::Ed25519 => Self::Ed25519, + SerializableCurveType::Secp256k1 => Self::Secp256k1, + } + } +} + +impl From for SerializableCurveType { + fn from(value: CurveType) -> Self { + match value { + CurveType::Ed25519 => Self::Ed25519, + CurveType::Secp256k1 => Self::Secp256k1, + } + } +} + +impl From for DecryptorsByCurve { + fn from(value: SerializableDecryptorsByCurve) -> Self { + match value { + SerializableDecryptorsByCurve::Ed25519 { + dh_ephemeral_public_key, + decryptors, + } => Self::Ed25519 { + dh_ephemeral_public_key: dh_ephemeral_public_key.into(), + decryptors: map_into!(decryptors), + }, + SerializableDecryptorsByCurve::Secp256k1 { + dh_ephemeral_public_key, + decryptors, + } => Self::Secp256k1 { + dh_ephemeral_public_key: dh_ephemeral_public_key.into(), + decryptors: map_into!(decryptors), + }, + } + } +} + +impl From for SerializableDecryptorsByCurve { + fn from(value: DecryptorsByCurve) -> Self { + match value { + DecryptorsByCurve::Ed25519 { + dh_ephemeral_public_key, + decryptors, + } => Self::Ed25519 { + dh_ephemeral_public_key: dh_ephemeral_public_key.into(), + decryptors: map_into!(decryptors), + }, + DecryptorsByCurve::Secp256k1 { + dh_ephemeral_public_key, + decryptors, + } => Self::Secp256k1 { + dh_ephemeral_public_key: dh_ephemeral_public_key.into(), + decryptors: map_into!(decryptors), + }, + } + } +} + +impl From for SerializableAesWrapped128BitKey { + fn from(value: AesWrapped128BitKey) -> Self { + value.0.into() + } +} + +impl From for AesWrapped128BitKey { + fn from(value: SerializableAesWrapped128BitKey) -> Self { + Self(*value) + } +} + +impl From for SerializablePublicKeyFingerprint { + fn from(value: PublicKeyFingerprint) -> Self { + value.0.into() + } +} + +impl From for PublicKeyFingerprint { + fn from(value: SerializablePublicKeyFingerprint) -> Self { + Self(*value) + } +} + +macro_rules! map_into { + ($map: expr) => { + $map.into_iter() + .map(|(key, value)| (key.into(), value.into())) + .collect() + }; +} +use map_into; diff --git a/radix-engine-toolkit/src/models/transaction/mod.rs b/radix-engine-toolkit/src/models/transaction/mod.rs new file mode 100644 index 00000000..d1c5f295 --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/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. + +pub mod header; +pub mod instruction; +pub mod instructions; +pub mod intent; +pub mod manifest; +pub mod message; +pub mod notarized_transaction; +pub mod signed_intent; +pub mod validation_config; diff --git a/radix-engine-toolkit/src/models/transaction/notarized_transaction.rs b/radix-engine-toolkit/src/models/transaction/notarized_transaction.rs new file mode 100644 index 00000000..6fa038d0 --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/notarized_transaction.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 schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::prelude::*; + +use crate::prelude::*; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SerializableNotarizedTransaction { + pub signed_intent: SerializableSignedIntent, + pub notary_signature: SerializableSignature, +} + +impl NativeConvertible for SerializableNotarizedTransaction { + type Native = NotarizedTransactionV1; + type Error = SerializableInstructionsError; + type Context = SerializableInstructionsKind; + + fn to_native(&self, network_id: u8) -> Result { + let signed_intent = self.signed_intent.to_native(network_id)?; + let notary_signature = NotarySignatureV1(self.notary_signature.clone().into()); + + Ok(NotarizedTransactionV1 { + notary_signature, + signed_intent, + }) + } + + fn from_native( + native: &Self::Native, + network_id: u8, + context: Self::Context, + ) -> Result { + let signed_intent = + SerializableSignedIntent::from_native(&native.signed_intent, network_id, context)?; + let notary_signature = native.notary_signature.0.into(); + + Ok(Self { + signed_intent, + notary_signature, + }) + } +} diff --git a/radix-engine-toolkit/src/models/transaction/signed_intent.rs b/radix-engine-toolkit/src/models/transaction/signed_intent.rs new file mode 100644 index 00000000..9b729f0d --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/signed_intent.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 schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::prelude::*; + +use crate::prelude::*; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SerializableSignedIntent { + pub intent: SerializableIntent, + pub intent_signatures: Vec, +} + +impl NativeConvertible for SerializableSignedIntent { + type Native = SignedIntentV1; + type Error = SerializableInstructionsError; + type Context = SerializableInstructionsKind; + + fn to_native(&self, network_id: u8) -> Result { + let intent = self.intent.to_native(network_id)?; + let intent_signatures = IntentSignaturesV1 { + signatures: self + .intent_signatures + .clone() + .into_iter() + .map(|signature| IntentSignatureV1(signature.into())) + .collect(), + }; + + Ok(SignedIntentV1 { + intent, + intent_signatures, + }) + } + + fn from_native( + native: &Self::Native, + network_id: u8, + context: Self::Context, + ) -> Result { + let intent = SerializableIntent::from_native(&native.intent, network_id, context)?; + let intent_signatures = native + .intent_signatures + .signatures + .iter() + .map(|signature| signature.0.into()) + .collect(); + + Ok(Self { + intent, + intent_signatures, + }) + } +} diff --git a/radix-engine-toolkit/src/models/transaction/validation_config.rs b/radix-engine-toolkit/src/models/transaction/validation_config.rs new file mode 100644 index 00000000..23d185e8 --- /dev/null +++ b/radix-engine-toolkit/src/models/transaction/validation_config.rs @@ -0,0 +1,94 @@ +// 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 schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use transaction::validation::{MessageValidationConfig, ValidationConfig}; + +use crate::prelude::*; + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SerializableValidationConfig { + pub network_id: SerializableU8, + pub max_notarized_payload_size: SerializableU64, + pub min_cost_unit_limit: SerializableU32, + pub max_cost_unit_limit: SerializableU32, + pub min_tip_percentage: SerializableU16, + pub max_tip_percentage: SerializableU16, + pub max_epoch_range: SerializableU64, + pub message_validation: SerializableMessageValidationConfig, +} + +#[derive(Serialize, Deserialize, JsonSchema, Clone, Debug, PartialEq, Eq)] +pub struct SerializableMessageValidationConfig { + pub max_plaintext_message_length: SerializableU64, + pub max_encrypted_message_length: SerializableU64, + pub max_mime_type_length: SerializableU64, + pub max_decryptors: SerializableU64, +} + +impl From for SerializableValidationConfig { + fn from(value: ValidationConfig) -> Self { + Self { + network_id: value.network_id.into(), + max_notarized_payload_size: (value.max_notarized_payload_size as u64).into(), + min_cost_unit_limit: value.min_cost_unit_limit.into(), + max_cost_unit_limit: value.max_cost_unit_limit.into(), + min_tip_percentage: value.min_tip_percentage.into(), + max_tip_percentage: value.max_tip_percentage.into(), + max_epoch_range: value.max_epoch_range.into(), + message_validation: value.message_validation.into(), + } + } +} + +impl From for ValidationConfig { + fn from(value: SerializableValidationConfig) -> Self { + Self { + network_id: *value.network_id, + max_notarized_payload_size: *value.max_notarized_payload_size as usize, + min_cost_unit_limit: *value.min_cost_unit_limit, + max_cost_unit_limit: *value.max_cost_unit_limit, + min_tip_percentage: *value.min_tip_percentage, + max_tip_percentage: *value.max_tip_percentage, + max_epoch_range: *value.max_epoch_range, + message_validation: MessageValidationConfig::from(value.message_validation), + } + } +} + +impl From for SerializableMessageValidationConfig { + fn from(value: MessageValidationConfig) -> Self { + Self { + max_plaintext_message_length: (value.max_plaintext_message_length as u64).into(), + max_encrypted_message_length: (value.max_encrypted_message_length as u64).into(), + max_mime_type_length: (value.max_mime_type_length as u64).into(), + max_decryptors: (value.max_decryptors as u64).into(), + } + } +} + +impl From for MessageValidationConfig { + fn from(value: SerializableMessageValidationConfig) -> Self { + Self { + max_plaintext_message_length: *value.max_plaintext_message_length as usize, + max_encrypted_message_length: *value.max_encrypted_message_length as usize, + max_mime_type_length: *value.max_mime_type_length as usize, + max_decryptors: *value.max_decryptors as usize, + } + } +} diff --git a/radix-engine-toolkit/src/models/value.rs b/radix-engine-toolkit/src/models/value.rs new file mode 100644 index 00000000..61677800 --- /dev/null +++ b/radix-engine-toolkit/src/models/value.rs @@ -0,0 +1,454 @@ +// 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::prelude::*; +use schemars::JsonSchema; +use serde::Deserialize; +use serde::Serialize; +use transaction::data::*; +use transaction::prelude::*; + +use crate::prelude::*; + +define_enum_and_kind! { + pub enum SerializableManifestValue { + Bool { + value: bool, + }, + I8 { + value: SerializableI8, + }, + I16 { + value: SerializableI16, + }, + I32 { + value: SerializableI32, + }, + I64 { + value: SerializableI64, + }, + I128 { + value: SerializableI128, + }, + U8 { + value: SerializableU8, + }, + U16 { + value: SerializableU16, + }, + U32 { + value: SerializableU32, + }, + U64 { + value: SerializableU64, + }, + U128 { + value: SerializableU128, + }, + String { + value: String, + }, + Enum { + discriminator: SerializableU8, + fields: Vec, + }, + Array { + element_value_kind: SerializableManifestValueKind, + elements: Vec, + }, + Tuple { + fields: Vec, + }, + Map { + key_value_kind: SerializableManifestValueKind, + value_value_kind: SerializableManifestValueKind, + entries: Vec<(Self, Self)>, + }, + Address { + value: SerializableManifestAddress, + }, + Bucket { + value: SerializableBucketId, + }, + Proof { + value: SerializableProofId, + }, + Expression { + value: SerializableExpression, + }, + Blob { + value: SerializableHash, + }, + Decimal { + value: SerializableDecimal, + }, + PreciseDecimal { + value: SerializablePreciseDecimal, + }, + NonFungibleLocalId { + value: SerializableNonFungibleLocalId, + }, + AddressReservation { + value: SerializableAddressReservation, + }, + } +} + +impl From for ManifestValueKind { + fn from(value: SerializableManifestValueKind) -> Self { + match value { + SerializableManifestValueKind::Bool => Self::Bool, + SerializableManifestValueKind::I8 => Self::I8, + SerializableManifestValueKind::I16 => Self::I16, + SerializableManifestValueKind::I32 => Self::I32, + SerializableManifestValueKind::I64 => Self::I64, + SerializableManifestValueKind::I128 => Self::I128, + SerializableManifestValueKind::U8 => Self::U8, + SerializableManifestValueKind::U16 => Self::U16, + SerializableManifestValueKind::U32 => Self::U32, + SerializableManifestValueKind::U64 => Self::U64, + SerializableManifestValueKind::U128 => Self::U128, + SerializableManifestValueKind::String => Self::String, + SerializableManifestValueKind::Enum => Self::Enum, + SerializableManifestValueKind::Array => Self::Array, + SerializableManifestValueKind::Tuple => Self::Tuple, + SerializableManifestValueKind::Map => Self::Map, + SerializableManifestValueKind::Address => { + Self::Custom(ManifestCustomValueKind::Address) + } + SerializableManifestValueKind::Bucket => Self::Custom(ManifestCustomValueKind::Bucket), + SerializableManifestValueKind::Proof => Self::Custom(ManifestCustomValueKind::Proof), + SerializableManifestValueKind::Expression => { + Self::Custom(ManifestCustomValueKind::Expression) + } + SerializableManifestValueKind::Blob => Self::Custom(ManifestCustomValueKind::Blob), + SerializableManifestValueKind::Decimal => { + Self::Custom(ManifestCustomValueKind::Decimal) + } + SerializableManifestValueKind::PreciseDecimal => { + Self::Custom(ManifestCustomValueKind::PreciseDecimal) + } + SerializableManifestValueKind::NonFungibleLocalId => { + Self::Custom(ManifestCustomValueKind::NonFungibleLocalId) + } + SerializableManifestValueKind::AddressReservation => { + Self::Custom(ManifestCustomValueKind::AddressReservation) + } + } + } +} + +impl From for SerializableManifestValueKind { + fn from(value: ManifestValueKind) -> Self { + 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::Array => Self::Array, + ManifestValueKind::Tuple => Self::Tuple, + ManifestValueKind::Map => Self::Map, + ManifestValueKind::Custom(custom) => match custom { + ManifestCustomValueKind::Address => Self::Address, + ManifestCustomValueKind::Bucket => Self::Bucket, + ManifestCustomValueKind::Proof => Self::Proof, + ManifestCustomValueKind::Expression => Self::Expression, + ManifestCustomValueKind::Blob => Self::Blob, + ManifestCustomValueKind::Decimal => Self::Decimal, + ManifestCustomValueKind::PreciseDecimal => Self::PreciseDecimal, + ManifestCustomValueKind::NonFungibleLocalId => Self::NonFungibleLocalId, + ManifestCustomValueKind::AddressReservation => Self::AddressReservation, + }, + } + } +} + +impl SerializableManifestValue { + pub fn from_typed( + manifest_value: &T, + network_id: u8, + ) -> Result { + let value = + manifest_decode::(&manifest_encode(manifest_value).unwrap()).unwrap(); + Self::from_manifest_value(&value, network_id) + } + + pub fn from_manifest_value( + manifest_value: &ManifestValue, + network_id: u8, + ) -> Result { + let value = match manifest_value { + ManifestValue::Bool { value } => Self::Bool { value: *value }, + ManifestValue::I8 { value } => Self::I8 { + value: into!(*value), + }, + ManifestValue::I16 { value } => Self::I16 { + value: into!(*value), + }, + ManifestValue::I32 { value } => Self::I32 { + value: into!(*value), + }, + ManifestValue::I64 { value } => Self::I64 { + value: into!(*value), + }, + ManifestValue::I128 { value } => Self::I128 { + value: into!(*value), + }, + ManifestValue::U8 { value } => Self::U8 { + value: into!(*value), + }, + ManifestValue::U16 { value } => Self::U16 { + value: into!(*value), + }, + ManifestValue::U32 { value } => Self::U32 { + value: into!(*value), + }, + ManifestValue::U64 { value } => Self::U64 { + value: into!(*value), + }, + ManifestValue::U128 { value } => Self::U128 { + value: into!(*value), + }, + ManifestValue::String { value } => Self::String { + value: value.to_owned(), + }, + ManifestValue::Enum { + discriminator, + fields, + } => Self::Enum { + discriminator: into!(*discriminator), + fields: fields + .iter() + .map(|value| Self::from_manifest_value(value, network_id)) + .collect::>()?, + }, + ManifestValue::Array { + element_value_kind, + elements, + } => Self::Array { + element_value_kind: into!(*element_value_kind), + elements: elements + .iter() + .map(|value| Self::from_manifest_value(value, network_id)) + .collect::>()?, + }, + ManifestValue::Tuple { fields } => Self::Tuple { + fields: fields + .iter() + .map(|value| Self::from_manifest_value(value, network_id)) + .collect::>()?, + }, + ManifestValue::Map { + key_value_kind, + value_value_kind, + entries, + } => Self::Map { + key_value_kind: into!(*key_value_kind), + value_value_kind: into!(*value_value_kind), + entries: entries + .iter() + .map(|(key, value)| { + Self::from_manifest_value(key, network_id).and_then(|key| { + Self::from_manifest_value(value, network_id).map(|value| (key, value)) + }) + }) + .collect::>()?, + }, + ManifestValue::Custom { + value: ManifestCustomValue::Address(value), + } => match value { + ManifestAddress::Named(named) => SerializableManifestValue::Address { + value: SerializableManifestAddress::Named { + value: into!(*named), + }, + }, + ManifestAddress::Static(node_id) => Self::Address { + value: SerializableManifestAddress::Static { + value: SerializableNodeId(SerializableNodeIdInternal { + node_id: *node_id, + network_id, + }), + }, + }, + }, + ManifestValue::Custom { + value: ManifestCustomValue::Bucket(value), + } => SerializableManifestValue::Bucket { + value: into!(*value), + }, + ManifestValue::Custom { + value: ManifestCustomValue::Proof(value), + } => SerializableManifestValue::Proof { + value: into!(*value), + }, + ManifestValue::Custom { + value: ManifestCustomValue::Expression(value), + } => SerializableManifestValue::Expression { + value: into!(*value), + }, + ManifestValue::Custom { + value: ManifestCustomValue::Blob(value), + } => SerializableManifestValue::Blob { + value: into!(Hash(value.0)), + }, + ManifestValue::Custom { + value: ManifestCustomValue::Decimal(value), + } => SerializableManifestValue::Decimal { + value: into!(to_decimal(value.clone())), + }, + ManifestValue::Custom { + value: ManifestCustomValue::PreciseDecimal(value), + } => SerializableManifestValue::PreciseDecimal { + value: into!(to_precise_decimal(value.clone())), + }, + ManifestValue::Custom { + value: ManifestCustomValue::NonFungibleLocalId(value), + } => SerializableManifestValue::NonFungibleLocalId { + value: into!(to_non_fungible_local_id(value.clone())), + }, + ManifestValue::Custom { + value: ManifestCustomValue::AddressReservation(value), + } => SerializableManifestValue::AddressReservation { + value: into!(*value), + }, + }; + Ok(value) + } + + pub fn to_manifest_value(&self) -> Result { + let value = match self { + Self::Bool { value } => ManifestValue::Bool { 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::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::String { value } => ManifestValue::String { + value: value.to_owned(), + }, + Self::Enum { + discriminator, + fields, + } => ManifestValue::Enum { + discriminator: **discriminator, + fields: fields + .iter() + .map(|value| value.to_manifest_value()) + .collect::>()?, + }, + Self::Array { + element_value_kind, + elements, + } => ManifestValue::Array { + element_value_kind: into!(*element_value_kind), + elements: elements + .iter() + .map(|value| value.to_manifest_value()) + .collect::>()?, + }, + Self::Tuple { fields } => ManifestValue::Tuple { + fields: fields + .iter() + .map(|value| value.to_manifest_value()) + .collect::>()?, + }, + Self::Map { + key_value_kind, + value_value_kind, + entries, + } => ManifestValue::Map { + key_value_kind: into!(*key_value_kind), + value_value_kind: into!(*value_value_kind), + entries: entries + .iter() + .map(|(key, value)| { + key.to_manifest_value() + .and_then(|key| value.to_manifest_value().map(|value| (key, value))) + }) + .collect::>()?, + }, + Self::Bucket { value } => ManifestValue::Custom { + value: ManifestCustomValue::Bucket(into!(*value)), + }, + Self::Proof { value } => ManifestValue::Custom { + value: ManifestCustomValue::Proof(into!(*value)), + }, + Self::AddressReservation { value } => ManifestValue::Custom { + value: ManifestCustomValue::AddressReservation(into!(*value)), + }, + Self::Expression { value } => ManifestValue::Custom { + value: ManifestCustomValue::Expression(into!(*value)), + }, + Self::Blob { value } => ManifestValue::Custom { + value: ManifestCustomValue::Blob(ManifestBlobRef((**value).0)), + }, + Self::Decimal { value } => ManifestValue::Custom { + value: ManifestCustomValue::Decimal(from_decimal(**value)), + }, + Self::PreciseDecimal { value } => ManifestValue::Custom { + value: ManifestCustomValue::PreciseDecimal(from_precise_decimal(**value)), + }, + Self::NonFungibleLocalId { value } => ManifestValue::Custom { + value: ManifestCustomValue::NonFungibleLocalId(from_non_fungible_local_id( + (**value).clone(), + )), + }, + Self::Address { value } => match value { + SerializableManifestAddress::Static { value } => ManifestValue::Custom { + value: ManifestCustomValue::Address(ManifestAddress::Static(value.0.node_id)), + }, + SerializableManifestAddress::Named { value } => ManifestValue::Custom { + value: ManifestCustomValue::Address(ManifestAddress::Named(into!(*value))), + }, + }, + }; + Ok(value) + } + + pub fn to_typed(&self) -> Result { + let value = self.to_manifest_value()?; + manifest_decode(&manifest_encode(&value).unwrap()) + .map_err(|error| ValueConversionError::DecodeError(format!("{:?}", error))) + } +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug, Clone)] +#[serde(tag = "kind", content = "error")] +pub enum ValueConversionError { + DecodeError(String), +} + +macro_rules! into { + ($expr: expr) => { + Into::into($expr) + }; +} +use into; diff --git a/radix-engine-toolkit/src/prelude.rs b/radix-engine-toolkit/src/prelude.rs new file mode 100644 index 00000000..b2d3b6d3 --- /dev/null +++ b/radix-engine-toolkit/src/prelude.rs @@ -0,0 +1,61 @@ +// 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(unused_imports)] + +pub use crate::error::*; +pub use crate::memory::*; +pub use crate::utils::*; + +pub use crate::functions::derive::*; +pub use crate::functions::execution::*; +pub use crate::functions::handler::*; +pub use crate::functions::information::*; +pub use crate::functions::instructions::*; +pub use crate::functions::intent::*; +pub use crate::functions::macros::*; +pub use crate::functions::manifest::*; +pub use crate::functions::manifest_sbor::*; +pub use crate::functions::notarized_transaction::*; +pub use crate::functions::scrypto_sbor::*; +pub use crate::functions::signed_intent::*; +pub use crate::functions::traits::*; +pub use crate::functions::utils::*; + +pub use crate::models::common::*; +pub use crate::models::cryptographic::public_key::*; +pub use crate::models::cryptographic::public_key_hash::*; +pub use crate::models::cryptographic::signature::*; +pub use crate::models::cryptographic::signature_with_public_key::*; +pub use crate::models::macros::*; +pub use crate::models::manifest::runtime::*; +pub use crate::models::olympia::network::*; +pub use crate::models::sbor::local_type_index::*; +pub use crate::models::sbor::serialization_mode::*; +pub use crate::models::scrypto::node_id::*; +pub use crate::models::scrypto::non_fungible_global_id::*; +pub use crate::models::traits::*; +pub use crate::models::transaction::header::*; +pub use crate::models::transaction::instruction::*; +pub use crate::models::transaction::instructions::*; +pub use crate::models::transaction::intent::*; +pub use crate::models::transaction::manifest::*; +pub use crate::models::transaction::message::*; +pub use crate::models::transaction::notarized_transaction::*; +pub use crate::models::transaction::signed_intent::*; +pub use crate::models::transaction::validation_config::*; +pub use crate::models::value::*; diff --git a/radix-engine-toolkit/src/request/analyze_manifest.rs b/radix-engine-toolkit/src/request/analyze_manifest.rs deleted file mode 100644 index a3cc01f7..00000000 --- a/radix-engine-toolkit/src/request/analyze_manifest.rs +++ /dev/null @@ -1,201 +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 std::collections::BTreeSet; - -use crate::error::Result; -use crate::model::address::{ - EntityAddress, NetworkAwareComponentAddress, NetworkAwarePackageAddress, - NetworkAwareResourceAddress, -}; -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 -// ================= - -/// Analyzes the passed manifest to determine the entities that this manifest interacts with. -#[serializable] -pub struct AnalyzeManifestRequest { - /// 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 response of the [`AnalyzeManifestRequest`] -#[serializable] -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>")] - 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>")] - 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>")] - 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>")] - 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>")] - 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>")] - 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>")] - pub accounts_deposited_into: BTreeSet, -} - -// =============== -// Implementation -// =============== - -pub struct AnalyzeManifestHandler; - -impl Handler for AnalyzeManifestHandler { - fn pre_process(mut request: AnalyzeManifestRequest) -> 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: &AnalyzeManifestRequest) -> 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(), - }), - } - }?; - - // Setting up the visitors and traversing the instructions - let mut address_aggregator_visitor = AddressAggregatorVisitor::default(); - let mut account_interactions_visitor = AccountInteractionsInstructionVisitor::default(); - instructions - .iter_mut() - .map(|instruction| { - traverse_instruction( - instruction, - &mut [&mut address_aggregator_visitor], - &mut [&mut account_interactions_visitor], - ) - }) - .collect::>>()?; - - let response = AnalyzeManifestResponse { - package_addresses: address_aggregator_visitor.package_addresses, - resource_addresses: address_aggregator_visitor.resource_addresses, - component_addresses: address_aggregator_visitor.component_addresses.clone(), - account_addresses: address_aggregator_visitor - .component_addresses - .into_iter() - .filter(|address| is_account(address)) - .collect(), - accounts_requiring_auth: account_interactions_visitor.auth_required, - accounts_withdrawn_from: account_interactions_visitor.accounts_withdrawn_from, - accounts_deposited_into: account_interactions_visitor.accounts_deposited_into, - }; - Ok(response) - } - - fn post_process( - _: &AnalyzeManifestRequest, - response: AnalyzeManifestResponse, - ) -> Result { - Ok(response) - } -} 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 deleted file mode 100644 index b4717aa7..00000000 --- a/radix-engine-toolkit/src/request/analyze_manifest_with_preview_context.rs +++ /dev/null @@ -1,391 +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 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 deleted file mode 100644 index 83fcb7f2..00000000 --- a/radix-engine-toolkit/src/request/compile_notarized_transaction.rs +++ /dev/null @@ -1,121 +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 super::traits::Handler; -use crate::error::Result; -use crate::model::instruction::Instruction; -use crate::model::transaction::{InstructionList, NotarizedTransaction}; -use crate::traits::CompilableIntent; -use crate::visitor::{traverse_instruction, ValueNetworkAggregatorVisitor}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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. -#[serializable] -pub struct CompileNotarizedTransactionRequest { - /// The notarized transaction intent to compile - #[serde(flatten)] - pub notarized_intent: NotarizedTransaction, -} - -/// The response from [`CompileNotarizedTransactionRequest`]. -#[serializable] -pub struct CompileNotarizedTransactionResponse { - /// A byte array serialized as a hex string which represents the compiled notarized transaction - /// intent. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_intent: Vec, -} - -// =============== -// Implementation -// =============== - -pub struct CompileNotarizedTransactionHandler; - -impl Handler - for CompileNotarizedTransactionHandler -{ - fn pre_process( - mut request: CompileNotarizedTransactionRequest, - ) -> Result { - // Visitors - let mut network_aggregator_visitor = ValueNetworkAggregatorVisitor::default(); - - // Instructions - let instructions: &mut [Instruction] = match request - .notarized_intent - .signed_intent - .intent - .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 - let expected_network_id = request - .notarized_intent - .signed_intent - .intent - .header - .network_id; - if let Some(network_id) = network_aggregator_visitor - .0 - .iter() - .find(|network_id| **network_id != expected_network_id) - { - return Err(crate::error::Error::NetworkMismatchError { - found: *network_id, - expected: expected_network_id, - }); - } - Ok(request) - } - - fn handle( - request: &CompileNotarizedTransactionRequest, - ) -> Result { - request - .notarized_intent - .compile() - .map(|compiled_intent| CompileNotarizedTransactionResponse { compiled_intent }) - } - - fn post_process( - _: &CompileNotarizedTransactionRequest, - response: CompileNotarizedTransactionResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/compile_signed_transaction_intent.rs b/radix-engine-toolkit/src/request/compile_signed_transaction_intent.rs deleted file mode 100644 index d77621a3..00000000 --- a/radix-engine-toolkit/src/request/compile_signed_transaction_intent.rs +++ /dev/null @@ -1,110 +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 super::traits::Handler; -use crate::error::Result; -use crate::model::instruction::Instruction; -use crate::model::transaction::{InstructionList, SignedTransactionIntent}; -use crate::traits::CompilableIntent; -use crate::visitor::{traverse_instruction, ValueNetworkAggregatorVisitor}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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. -#[serializable] -pub struct CompileSignedTransactionIntentRequest { - /// The signed transaction intent to compile - #[serde(flatten)] - pub signed_intent: SignedTransactionIntent, -} - -/// The response from [`CompileSignedTransactionIntentRequest`]. -#[serializable] -pub struct CompileSignedTransactionIntentResponse { - /// A byte array serialized as a hex string which represents the compiled signed transaction - /// intent. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_intent: Vec, -} - -// =============== -// Implementation -// =============== - -pub struct CompileSignedTransactionIntentHandler; - -impl Handler - for CompileSignedTransactionIntentHandler -{ - fn pre_process( - mut request: CompileSignedTransactionIntentRequest, - ) -> Result { - // Visitors - let mut network_aggregator_visitor = ValueNetworkAggregatorVisitor::default(); - - // Instructions - let instructions: &mut [Instruction] = - match request.signed_intent.intent.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 - let expected_network_id = request.signed_intent.intent.header.network_id; - if let Some(network_id) = network_aggregator_visitor - .0 - .iter() - .find(|network_id| **network_id != expected_network_id) - { - return Err(crate::error::Error::NetworkMismatchError { - found: *network_id, - expected: expected_network_id, - }); - } - Ok(request) - } - - fn handle( - request: &CompileSignedTransactionIntentRequest, - ) -> Result { - request - .signed_intent - .compile() - .map(|compiled_intent| CompileSignedTransactionIntentResponse { compiled_intent }) - } - - fn post_process( - _: &CompileSignedTransactionIntentRequest, - response: CompileSignedTransactionIntentResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/compile_transaction_intent.rs b/radix-engine-toolkit/src/request/compile_transaction_intent.rs deleted file mode 100644 index c65a724f..00000000 --- a/radix-engine-toolkit/src/request/compile_transaction_intent.rs +++ /dev/null @@ -1,109 +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 super::traits::Handler; -use crate::error::Result; -use crate::model::instruction::Instruction; -use crate::model::transaction::{InstructionList, TransactionIntent}; -use crate::traits::CompilableIntent; -use crate::visitor::{traverse_instruction, ValueNetworkAggregatorVisitor}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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. -#[serializable] -pub struct CompileTransactionIntentRequest { - /// The transaction intent to compile. - #[serde(flatten)] - pub transaction_intent: TransactionIntent, -} - -/// The response from [`CompileTransactionIntentRequest`]. -#[serializable] -pub struct CompileTransactionIntentResponse { - /// A byte array serialized as a hex string which represents the compiled transaction intent. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_intent: Vec, -} - -// =============== -// Implementation -// =============== - -pub struct CompileTransactionIntentHandler; - -impl Handler - for CompileTransactionIntentHandler -{ - fn pre_process( - mut request: CompileTransactionIntentRequest, - ) -> Result { - // Visitors - let mut network_aggregator_visitor = ValueNetworkAggregatorVisitor::default(); - - // Instructions - let instructions: &mut [Instruction] = - match request.transaction_intent.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 - let expected_network_id = request.transaction_intent.header.network_id; - if let Some(network_id) = network_aggregator_visitor - .0 - .iter() - .find(|network_id| **network_id != expected_network_id) - { - return Err(crate::error::Error::NetworkMismatchError { - found: *network_id, - expected: expected_network_id, - }); - } - Ok(request) - } - - fn handle( - request: &CompileTransactionIntentRequest, - ) -> Result { - request - .transaction_intent - .compile() - .map(|compiled_intent| CompileTransactionIntentResponse { compiled_intent }) - } - - fn post_process( - _: &CompileTransactionIntentRequest, - response: CompileTransactionIntentResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/convert_manifest.rs b/radix-engine-toolkit/src/request/convert_manifest.rs deleted file mode 100644 index 74b2527e..00000000 --- a/radix-engine-toolkit/src/request/convert_manifest.rs +++ /dev/null @@ -1,155 +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 super::traits::Handler; -use crate::error::Result; -use crate::model::address::Bech32Coder; -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 -// ================= - -/// 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. If a JSON interface for the Radix Engine Toolkit is used, -/// then the parsed instructions will be all in JSON. -/// -/// This function allows the client the convert their manifest between the two supported manifest -/// types: string and parsed. -#[serializable] -pub struct ConvertManifestRequest { - /// 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, - - /// Defines the output format that we would like the manifest to be in after this request is - /// performed. - pub instructions_output_kind: InstructionKind, - - /// The manifest to convert to the format described by `instructions_output_kind` - pub manifest: TransactionManifest, -} - -/// The response of the [`ConvertManifestRequest`] -#[serializable] -pub struct ConvertManifestResponse { - /// The manifest after it has been converted to the instruction kind specified in the request - #[serde(flatten)] - pub manifest: TransactionManifest, -} - -// =============== -// Implementation -// =============== - -pub struct ConvertManifestHandler; - -impl Handler for ConvertManifestHandler { - fn pre_process(mut request: ConvertManifestRequest) -> 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: &ConvertManifestRequest) -> Result { - request - .manifest - .instructions - .convert_to_manifest_instructions_kind( - request.instructions_output_kind, - &Bech32Coder::new(request.network_id), - request.manifest.blobs.clone(), - ) - .map(|instructions| ConvertManifestResponse { - manifest: TransactionManifest { - instructions, - blobs: request.manifest.blobs.clone(), - }, - }) - } - - fn post_process( - _: &ConvertManifestRequest, - mut response: ConvertManifestResponse, - ) -> Result { - // Visitors - let mut aliasing_visitor = ValueAliasingVisitor::default(); - - // Instructions - let instructions: &mut [Instruction] = match response.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 aliasing_visitor], &mut []) - }) - .collect::>>()?; - - // 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/decode_address.rs b/radix-engine-toolkit/src/request/decode_address.rs deleted file mode 100644 index 53f0838c..00000000 --- a/radix-engine-toolkit/src/request/decode_address.rs +++ /dev/null @@ -1,113 +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 super::traits::Handler; -use crate::error::Result; -use crate::model::address::{EntityAddress, EntityType}; -use crate::utils::network_definition_from_network_id; -use toolkit_derive::serializable; - -use bech32::{self, FromBase32, Variant}; -use scrypto::address::AddressError; - -// ================= -// Model Definition -// ================= - -/// This request can be used to decode a Bech32m encoded address string into its equivalent hrp and -/// data. In addition to that, this request 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. -#[serializable] -pub struct DecodeAddressRequest { - /// A string of the Bech32m encoded address to decode. Decoding this address will expose its - /// entity type, network id, network name, underlying data, as well as it's Bech32m HRP. - pub address: String, -} - -#[serializable] -pub struct DecodeAddressResponse { - /// An 8 bit unsigned integer serialized as a string which represents the id of the network - /// that this address exists on. This is derived from the HRP of the Bech32m encoded - /// address. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub network_id: u8, - - /// A string which represents the name of the network that this address exists on. This is - /// derived from the HRP of the Bech32m encoded address. - pub network_name: String, - - /// An [`EntityType`] enum representing the type of entity addressed with the passed address. - /// This is derived from the entity byte on the address data. - pub entity_type: EntityType, - - /// A byte array of 27 bytes (54 hex characters) serialized as a hex string which represents - /// the data encoded in the address. - #[schemars(with = "String")] - #[schemars(length(equal = 54))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub data: Vec, - - /// A string which represents the Bech32m Human Readable Part (HRP) of the passed address - /// string - pub hrp: String, -} - -// =============== -// Implementation -// =============== - -pub struct DecodeAddressHandler; - -impl Handler for DecodeAddressHandler { - fn pre_process(request: DecodeAddressRequest) -> Result { - Ok(request) - } - - fn handle(request: &DecodeAddressRequest) -> Result { - // We need to deduce the network from the HRP of the passed address. Therefore, we need to - // begin by decoding the address, and getting the HRP. - let (hrp, data, variant) = - bech32::decode(&request.address).map_err(AddressError::Bech32mDecodingError)?; - let data = Vec::::from_base32(&data).map_err(AddressError::Bech32mDecodingError)?; - - match variant { - Variant::Bech32m => Ok(()), - variant => Err(AddressError::InvalidVariant(variant)), - }?; - - let address = request.address.parse::()?; - let network_definition = network_definition_from_network_id(address.network_id()); - - Ok(DecodeAddressResponse { - network_id: network_definition.id, - network_name: network_definition.logical_name, - hrp, - data, - entity_type: address.kind().into(), - }) - } - - fn post_process( - _: &DecodeAddressRequest, - response: DecodeAddressResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs b/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs deleted file mode 100644 index bbb8cf48..00000000 --- a/radix-engine-toolkit/src/request/decompile_notarized_transaction.rs +++ /dev/null @@ -1,113 +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 super::traits::Handler; -use crate::error::Result; -use crate::model::instruction::Instruction; -use crate::model::transaction::{InstructionKind, InstructionList, NotarizedTransaction}; -use crate::traits::CompilableIntent; -use crate::visitor::{traverse_instruction, ValueAliasingVisitor}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// This function does the opposite of the compile_notarized_transaction_intent function. This -/// function takes in a compiled notarized transaction intent and decompiles it into its signed -/// transaction intent and notary signature. -#[serializable] -pub struct DecompileNotarizedTransactionRequest { - /// Defines the output format that we would like the manifest to be in after this request is - /// performed. - pub instructions_output_kind: InstructionKind, - - /// A byte array serialized as a hex string which represents the compiled notarized transaction - /// intent to decompile. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_notarized_intent: Vec, -} - -/// The response from [`DecompileNotarizedTransactionRequest`]. -#[serializable] -pub struct DecompileNotarizedTransactionResponse { - /// The decompiled notarized transaction intent where the instructions are in the format - /// specified in the request. - #[serde(flatten)] - pub notarized_intent: NotarizedTransaction, -} - -// =============== -// Implementation -// =============== - -pub struct DecompileNotarizedTransactionHandler; - -impl Handler - for DecompileNotarizedTransactionHandler -{ - fn pre_process( - request: DecompileNotarizedTransactionRequest, - ) -> Result { - Ok(request) - } - - fn handle( - request: &DecompileNotarizedTransactionRequest, - ) -> Result { - NotarizedTransaction::decompile( - &request.compiled_notarized_intent, - request.instructions_output_kind, - ) - .map(|notarized_intent| DecompileNotarizedTransactionResponse { notarized_intent }) - } - - fn post_process( - _: &DecompileNotarizedTransactionRequest, - mut response: DecompileNotarizedTransactionResponse, - ) -> Result { - // Visitors - let mut aliasing_visitor = ValueAliasingVisitor::default(); - - // Instructions - let instructions: &mut [Instruction] = match response - .notarized_intent - .signed_intent - .intent - .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 aliasing_visitor], &mut []) - }) - .collect::>>()?; - - // 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/decompile_signed_transaction_intent.rs b/radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs deleted file mode 100644 index e415ff3a..00000000 --- a/radix-engine-toolkit/src/request/decompile_signed_transaction_intent.rs +++ /dev/null @@ -1,108 +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 super::traits::Handler; -use crate::error::Result; -use crate::model::instruction::Instruction; -use crate::model::transaction::{InstructionKind, InstructionList, SignedTransactionIntent}; -use crate::traits::CompilableIntent; -use crate::visitor::{traverse_instruction, ValueAliasingVisitor}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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. -#[serializable] -pub struct DecompileSignedTransactionIntentRequest { - /// Defines the output format that we would like the manifest to be in after this request is - /// performed. - pub instructions_output_kind: InstructionKind, - - /// A byte array serialized as a hex string which represents the compiled signed transaction - /// intent to decompile. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_signed_intent: Vec, -} - -/// The response from [`DecompileSignedTransactionIntentRequest`]. -#[serializable] -pub struct DecompileSignedTransactionIntentResponse { - /// The decompiled signed transaction intent where the instructions are in the format specified - /// in the request. - #[serde(flatten)] - pub signed_intent: SignedTransactionIntent, -} - -// =============== -// Implementation -// =============== - -pub struct DecompileSignedTransactionIntentHandler; - -impl Handler - for DecompileSignedTransactionIntentHandler -{ - fn pre_process( - request: DecompileSignedTransactionIntentRequest, - ) -> Result { - Ok(request) - } - - fn handle( - request: &DecompileSignedTransactionIntentRequest, - ) -> Result { - SignedTransactionIntent::decompile( - &request.compiled_signed_intent, - request.instructions_output_kind, - ) - .map(|signed_intent| DecompileSignedTransactionIntentResponse { signed_intent }) - } - - fn post_process( - _: &DecompileSignedTransactionIntentRequest, - mut response: DecompileSignedTransactionIntentResponse, - ) -> Result { - // Visitors - let mut aliasing_visitor = ValueAliasingVisitor::default(); - - // Instructions - let instructions: &mut [Instruction] = - match response.signed_intent.intent.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 aliasing_visitor], &mut []) - }) - .collect::>>()?; - - // 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/decompile_transaction_intent.rs b/radix-engine-toolkit/src/request/decompile_transaction_intent.rs deleted file mode 100644 index 3c6b8394..00000000 --- a/radix-engine-toolkit/src/request/decompile_transaction_intent.rs +++ /dev/null @@ -1,104 +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 super::traits::Handler; -use crate::error::Result; -use crate::model::instruction::Instruction; -use crate::model::transaction::{InstructionKind, InstructionList, TransactionIntent}; -use crate::traits::CompilableIntent; -use crate::visitor::{traverse_instruction, ValueAliasingVisitor}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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. -#[serializable] -pub struct DecompileTransactionIntentRequest { - /// Defines the output format that we would like the manifest to be in after this request is - /// performed. - pub instructions_output_kind: InstructionKind, - - /// A byte array serialized as a hex string which represents the compiled transaction intent to - /// decompile. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_intent: Vec, -} - -/// The response from [`DecompileTransactionIntentRequest`]. -#[serializable] -pub struct DecompileTransactionIntentResponse { - /// The decompiled transaction intent where the instructions are in the format specified in the - /// request. - #[serde(flatten)] - pub transaction_intent: TransactionIntent, -} - -// =============== -// Implementation -// =============== - -pub struct DecompileTransactionIntentHandler; - -impl Handler - for DecompileTransactionIntentHandler -{ - fn pre_process( - request: DecompileTransactionIntentRequest, - ) -> Result { - Ok(request) - } - - fn handle( - request: &DecompileTransactionIntentRequest, - ) -> Result { - TransactionIntent::decompile(&request.compiled_intent, request.instructions_output_kind) - .map(|transaction_intent| DecompileTransactionIntentResponse { transaction_intent }) - } - - fn post_process( - _: &DecompileTransactionIntentRequest, - mut response: DecompileTransactionIntentResponse, - ) -> Result { - // Visitors - let mut aliasing_visitor = ValueAliasingVisitor::default(); - - // Instructions - let instructions: &mut [Instruction] = - match response.transaction_intent.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 aliasing_visitor], &mut []) - }) - .collect::>>()?; - - // 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/decompile_unknown_intent.rs b/radix-engine-toolkit/src/request/decompile_unknown_intent.rs deleted file mode 100644 index 2c26900a..00000000 --- a/radix-engine-toolkit/src/request/decompile_unknown_intent.rs +++ /dev/null @@ -1,238 +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 super::decompile_notarized_transaction::{ - DecompileNotarizedTransactionHandler, DecompileNotarizedTransactionRequest, - DecompileNotarizedTransactionResponse, -}; -use super::decompile_signed_transaction_intent::{ - DecompileSignedTransactionIntentHandler, DecompileSignedTransactionIntentRequest, - DecompileSignedTransactionIntentResponse, -}; -use super::decompile_transaction_intent::{ - DecompileTransactionIntentHandler, DecompileTransactionIntentRequest, - DecompileTransactionIntentResponse, -}; -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 -// ================= - -/// 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. -#[serializable] -pub struct DecompileUnknownTransactionIntentRequest { - /// Defines the output format that we would like the manifest to be in after this request is - /// performed. - pub instructions_output_kind: InstructionKind, - - /// A byte array serialized as a hex string which represents what is suspected to be a compiled - /// intent of an unknown kind. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_unknown_intent: Vec, -} - -/// The response from [`DecompileUnknownTransactionIntentRequest`]. This is an tagged union which -/// can either be a [`DecompileTransactionIntentResponse`], -/// [`DecompileSignedTransactionIntentResponse`], or [`DecompileNotarizedTransactionResponse`] -/// depending on the passed intent. -#[serializable] -#[serde(tag = "type", content = "value")] -pub enum DecompileUnknownTransactionIntentResponse { - TransactionIntent(DecompileTransactionIntentResponse), - SignedTransactionIntent(DecompileSignedTransactionIntentResponse), - NotarizedTransactionIntent(DecompileNotarizedTransactionResponse), -} - -impl From for DecompileTransactionIntentRequest { - fn from(request: DecompileUnknownTransactionIntentRequest) -> Self { - DecompileTransactionIntentRequest { - compiled_intent: request.compiled_unknown_intent, - instructions_output_kind: request.instructions_output_kind, - } - } -} - -// ============ -// Conversions -// ============ - -impl From for DecompileSignedTransactionIntentRequest { - fn from(request: DecompileUnknownTransactionIntentRequest) -> Self { - DecompileSignedTransactionIntentRequest { - compiled_signed_intent: request.compiled_unknown_intent, - instructions_output_kind: request.instructions_output_kind, - } - } -} - -impl From for DecompileNotarizedTransactionRequest { - fn from(request: DecompileUnknownTransactionIntentRequest) -> Self { - DecompileNotarizedTransactionRequest { - compiled_notarized_intent: request.compiled_unknown_intent, - instructions_output_kind: request.instructions_output_kind, - } - } -} - -impl From for DecompileUnknownTransactionIntentResponse { - fn from(response: DecompileTransactionIntentResponse) -> Self { - Self::TransactionIntent(response) - } -} - -impl From for DecompileUnknownTransactionIntentResponse { - fn from(response: DecompileSignedTransactionIntentResponse) -> Self { - Self::SignedTransactionIntent(response) - } -} - -impl From for DecompileUnknownTransactionIntentResponse { - fn from(response: DecompileNotarizedTransactionResponse) -> Self { - Self::NotarizedTransactionIntent(response) - } -} - -// =============== -// Implementation -// =============== - -pub struct DecompileUnknownTransactionIntentHandler; - -impl Handler - for DecompileUnknownTransactionIntentHandler -{ - fn pre_process( - request: DecompileUnknownTransactionIntentRequest, - ) -> Result { - Ok(request) - } - - fn handle( - request: &DecompileUnknownTransactionIntentRequest, - ) -> Result { - if let Ok(response) = DecompileTransactionIntentHandler::fulfill(request.clone().into()) { - Ok(response.into()) - } else if let Ok(response) = - DecompileSignedTransactionIntentHandler::fulfill(request.clone().into()) - { - Ok(response.into()) - } else if let Ok(response) = - DecompileNotarizedTransactionHandler::fulfill(request.clone().into()) - { - Ok(response.into()) - } else { - Err(Error::UnrecognizedCompiledIntentFormat) - } - } - - fn post_process( - _: &DecompileUnknownTransactionIntentRequest, - mut response: DecompileUnknownTransactionIntentResponse, - ) -> Result { - // Visitors - let mut aliasing_visitor = ValueAliasingVisitor::default(); - - // Instructions - let instructions: &mut [Instruction] = match response { - DecompileUnknownTransactionIntentResponse::NotarizedTransactionIntent( - DecompileNotarizedTransactionResponse { - notarized_intent: - NotarizedTransaction { - signed_intent: - SignedTransactionIntent { - intent: - TransactionIntent { - manifest: - TransactionManifest { - instructions: - InstructionList::Parsed(ref mut instructions), - .. - }, - .. - }, - .. - }, - .. - }, - }, - ) - | DecompileUnknownTransactionIntentResponse::SignedTransactionIntent( - DecompileSignedTransactionIntentResponse { - signed_intent: - SignedTransactionIntent { - intent: - TransactionIntent { - manifest: - TransactionManifest { - instructions: - InstructionList::Parsed(ref mut instructions), - .. - }, - .. - }, - .. - }, - }, - ) - | DecompileUnknownTransactionIntentResponse::TransactionIntent( - DecompileTransactionIntentResponse { - transaction_intent: - TransactionIntent { - manifest: - TransactionManifest { - instructions: InstructionList::Parsed(ref mut instructions), - .. - }, - .. - }, - }, - ) => instructions, - _ => &mut [], - }; - - // Traverse instructions with visitors - instructions - .iter_mut() - .map(|instruction| { - traverse_instruction(instruction, &mut [&mut aliasing_visitor], &mut []) - }) - .collect::>>()?; - - // 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/derive_babylon_address_from_olympia_address.rs b/radix-engine-toolkit/src/request/derive_babylon_address_from_olympia_address.rs deleted file mode 100644 index 11600bff..00000000 --- a/radix-engine-toolkit/src/request/derive_babylon_address_from_olympia_address.rs +++ /dev/null @@ -1,142 +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 bech32::FromBase32; -use radix_engine_common::address::AddressError; -use radix_engine_common::crypto::EcdsaSecp256k1PublicKey; -use scrypto::prelude::{ComponentAddress, PublicKey}; -use toolkit_derive::serializable; - -use crate::error::{Error, Result}; -use crate::model::address::EntityAddress; -use crate::model::address::NetworkAwareComponentAddress; -use crate::utils::checked_copy_u8_slice; - -use super::traits::Handler; - -// ================= -// Model Definition -// ================= - -/// 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. -#[serializable] -pub struct DeriveBabylonAddressFromOlympiaAddressRequest { - /// 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 - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub network_id: u8, - - /// A string of the address on the Olympia network - pub olympia_account_address: String, -} - -/// The response form [`DeriveBabylonAddressFromOlympiaAddressRequest`] requests -#[serializable] -pub struct DeriveBabylonAddressFromOlympiaAddressResponse { - /// The Babylon account address associated with the Olympia address. - #[schemars(with = "EntityAddress")] - #[serde_as(as = "serde_with::TryFromInto")] - pub babylon_account_address: NetworkAwareComponentAddress, - - /// The public key associated with the Olympia account address. - #[schemars(with = "crate::model::crypto::PublicKey")] - #[serde_as(as = "serde_with::FromInto")] - pub public_key: PublicKey, -} - -// =============== -// Implementation -// =============== - -pub struct DeriveBabylonAddressFromOlympiaAddressHandler; - -impl - Handler< - DeriveBabylonAddressFromOlympiaAddressRequest, - DeriveBabylonAddressFromOlympiaAddressResponse, - > 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 deleted file mode 100644 index b9ef7c3c..00000000 --- a/radix-engine-toolkit/src/request/derive_non_fungible_global_id_from_public_key.rs +++ /dev/null @@ -1,93 +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::Result; -use crate::model::address::NonFungibleGlobalId; -use crate::request::traits::Handler; -use scrypto::prelude::{FromPublicKey, PublicKey}; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// This function derives the non-fungible global id of the virtual badge associated with the passed -/// public key. -#[serializable] -pub struct DeriveNonFungibleGlobalIdFromPublicKeyRequest { - /// An 8 bit unsigned integer serialized as a string which represents the id of the network - /// that the virtual badge non-fungible global id is being derived for. - #[schemars(with = "String")] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub network_id: u8, - - /// The public key to derive the non-fungible global id for. - #[schemars(with = "crate::model::crypto::PublicKey")] - #[serde_as(as = "serde_with::FromInto")] - pub public_key: PublicKey, -} - -/// The response from [`DeriveNonFungibleGlobalIdFromPublicKeyRequest`]. -#[serializable] -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. - pub non_fungible_global_id: NonFungibleGlobalId, -} - -// =============== -// Implementation -// =============== - -pub struct DeriveNonFungibleGlobalIdFromPublicKeyHandler; - -impl - Handler< - DeriveNonFungibleGlobalIdFromPublicKeyRequest, - DeriveNonFungibleGlobalIdFromPublicKeyResponse, - > for DeriveNonFungibleGlobalIdFromPublicKeyHandler -{ - fn pre_process( - request: DeriveNonFungibleGlobalIdFromPublicKeyRequest, - ) -> Result { - Ok(request) - } - - fn handle( - request: &DeriveNonFungibleGlobalIdFromPublicKeyRequest, - ) -> Result { - let non_fungible_global_id = - scrypto::prelude::NonFungibleGlobalId::from_public_key(&request.public_key); - let non_fungible_global_id = NonFungibleGlobalId { - resource_address: crate::model::address::NetworkAwareResourceAddress { - network_id: request.network_id, - address: non_fungible_global_id.resource_address(), - }, - non_fungible_local_id: non_fungible_global_id.local_id().clone(), - }; - Ok(DeriveNonFungibleGlobalIdFromPublicKeyResponse { - non_fungible_global_id, - }) - } - - fn post_process( - _: &DeriveNonFungibleGlobalIdFromPublicKeyRequest, - response: DeriveNonFungibleGlobalIdFromPublicKeyResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/derive_virtual_account_address.rs b/radix-engine-toolkit/src/request/derive_virtual_account_address.rs deleted file mode 100644 index a298fb59..00000000 --- a/radix-engine-toolkit/src/request/derive_virtual_account_address.rs +++ /dev/null @@ -1,90 +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 scrypto::prelude::{ComponentAddress, PublicKey}; -use toolkit_derive::serializable; - -use crate::error::Result; -use crate::model::address::EntityAddress; -use crate::model::address::NetworkAwareComponentAddress; - -use super::traits::Handler; - -// ================= -// Model Definition -// ================= - -/// Derives the virtual account component address given a public key and a network id. -#[serializable] -pub struct DeriveVirtualAccountAddressRequest { - /// 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 - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub network_id: u8, - - /// The public key to derive the virtual account address for - #[schemars(with = "crate::model::crypto::PublicKey")] - #[serde_as(as = "serde_with::FromInto")] - pub public_key: PublicKey, -} - -/// The response form [`DeriveVirtualAccountAddressRequest`] requests -#[serializable] -pub struct DeriveVirtualAccountAddressResponse { - /// The virtual account component address serialized as a `ComponentAddress` from the `Value` - /// model. - #[schemars(with = "EntityAddress")] - #[serde_as(as = "serde_with::TryFromInto")] - pub virtual_account_address: NetworkAwareComponentAddress, -} - -// =============== -// Implementation -// =============== - -pub struct DeriveVirtualAccountAddressHandler; - -impl Handler - for DeriveVirtualAccountAddressHandler -{ - fn pre_process( - request: DeriveVirtualAccountAddressRequest, - ) -> Result { - Ok(request) - } - - fn handle( - request: &DeriveVirtualAccountAddressRequest, - ) -> Result { - Ok(DeriveVirtualAccountAddressResponse { - virtual_account_address: NetworkAwareComponentAddress { - network_id: request.network_id, - address: ComponentAddress::virtual_account_from_public_key(&request.public_key), - }, - }) - } - - fn post_process( - _: &DeriveVirtualAccountAddressRequest, - response: DeriveVirtualAccountAddressResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs b/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs deleted file mode 100644 index b12fce5a..00000000 --- a/radix-engine-toolkit/src/request/derive_virtual_identity_address.rs +++ /dev/null @@ -1,89 +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 scrypto::prelude::{ComponentAddress, PublicKey}; -use toolkit_derive::serializable; - -use crate::error::Result; -use crate::model::address::EntityAddress; -use crate::model::address::NetworkAwareComponentAddress; -use crate::request::traits::Handler; - -// ================= -// Model Definition -// ================= - -/// Derives the virtual identity component address given a public key and a network id. -#[serializable] -pub struct DeriveVirtualIdentityAddressRequest { - /// 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 - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub network_id: u8, - - /// The public key to derive the virtual identity address for - #[schemars(with = "crate::model::crypto::PublicKey")] - #[serde_as(as = "serde_with::FromInto")] - pub public_key: PublicKey, -} - -/// The response form [`DeriveVirtualIdentityAddressRequest`] requests -#[serializable] -pub struct DeriveVirtualIdentityAddressResponse { - /// The virtual identity component address serialized as a `ComponentAddress` from the `Value` - /// model. - #[schemars(with = "EntityAddress")] - #[serde_as(as = "serde_with::TryFromInto")] - pub virtual_identity_address: NetworkAwareComponentAddress, -} - -// =============== -// Implementation -// =============== - -pub struct DeriveVirtualIdentityAddressHandler; - -impl Handler - for DeriveVirtualIdentityAddressHandler -{ - fn pre_process( - request: DeriveVirtualIdentityAddressRequest, - ) -> Result { - Ok(request) - } - - fn handle( - request: &DeriveVirtualIdentityAddressRequest, - ) -> Result { - Ok(DeriveVirtualIdentityAddressResponse { - virtual_identity_address: NetworkAwareComponentAddress { - network_id: request.network_id, - address: ComponentAddress::virtual_identity_from_public_key(&request.public_key), - }, - }) - } - - fn post_process( - _: &DeriveVirtualIdentityAddressRequest, - response: DeriveVirtualIdentityAddressResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/encode_address.rs b/radix-engine-toolkit/src/request/encode_address.rs deleted file mode 100644 index 41e8afde..00000000 --- a/radix-engine-toolkit/src/request/encode_address.rs +++ /dev/null @@ -1,79 +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::Result; -use crate::model::address::EntityAddress; -use crate::request::traits::Handler; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// This request 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. -#[serializable] -pub struct EncodeAddressRequest { - /// A byte array of 27 bytes (54 hex characters) serialized as a hex string of the data part of - /// the address. - #[schemars(with = "String")] - #[schemars(length(equal = 54))] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub address_bytes: Vec, - - /// An 8 bit unsigned integer serialized as a string which represents the id of the network - /// that this address exists on. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub network_id: u8, -} - -/// The response from [`EncodeAddressRequest`]. -#[serializable] -pub struct EncodeAddressResponse { - /// A discriminated union of entity addresses where addresses are serialized as a Bech32m - /// encoded string. - #[serde(flatten)] - pub address: EntityAddress, -} - -// =============== -// Implementation -// =============== - -pub struct EncodeAddressHandler; - -impl Handler for EncodeAddressHandler { - fn pre_process(request: EncodeAddressRequest) -> crate::error::Result { - Ok(request) - } - - fn handle(request: &EncodeAddressRequest) -> crate::error::Result { - EntityAddress::from_u8_array(&request.address_bytes, request.network_id) - .map(|address| EncodeAddressResponse { address }) - } - - fn post_process( - _: &EncodeAddressRequest, - response: EncodeAddressResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/hash.rs b/radix-engine-toolkit/src/request/hash.rs deleted file mode 100644 index b4d6e58c..00000000 --- a/radix-engine-toolkit/src/request/hash.rs +++ /dev/null @@ -1,70 +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::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 deleted file mode 100644 index a90a909a..00000000 --- a/radix-engine-toolkit/src/request/information.rs +++ /dev/null @@ -1,71 +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::Result; -use crate::request::traits::Handler; -use toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -#[serializable] -/// The request 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. -pub struct InformationRequest {} - -/// The response from [`InformationRequest`]s -#[serializable] -pub struct InformationResponse { - /// 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. - pub package_version: String, - - /// 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 last_commit_hash: String, -} - -// =============== -// Implementation -// =============== - -pub struct InformationHandler; - -impl Handler for InformationHandler { - fn pre_process(request: InformationRequest) -> Result { - Ok(request) - } - - fn handle(_: &InformationRequest) -> Result { - let response = InformationResponse { - package_version: env!("CARGO_PKG_VERSION").into(), - last_commit_hash: env!("GIT_HASH").into(), - }; - Ok(response) - } - - fn post_process( - _: &InformationRequest, - response: InformationResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/known_entity_addresses.rs b/radix-engine-toolkit/src/request/known_entity_addresses.rs deleted file mode 100644 index d7eb072f..00000000 --- a/radix-engine-toolkit/src/request/known_entity_addresses.rs +++ /dev/null @@ -1,178 +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::Result; -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 toolkit_derive::serializable; - -// ================= -// Model Definition -// ================= - -/// 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). -#[serializable] -pub struct KnownEntityAddressesRequest { - /// An unsigned 8 bit integer serialized as a string which represents the ID of the network - /// that the addresses 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 response from [`KnownEntityAddressesRequest`] requests -#[serializable] -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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "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 = "EntityAddress")] - #[serde_as(as = "serde_with::TryFromInto")] - pub clock_system_address: NetworkAwareComponentAddress, -} - -// =============== -// Implementation -// =============== - -pub struct KnownEntityAddressesHandler; - -impl Handler - for KnownEntityAddressesHandler -{ - fn pre_process(request: KnownEntityAddressesRequest) -> Result { - Ok(request) - } - - fn handle(request: &KnownEntityAddressesRequest) -> Result { - let network_id = request.network_id; - Ok(KnownEntityAddressesResponse { - faucet_component_address: NetworkAwareComponentAddress { - address: FAUCET_COMPONENT, - network_id, - }, - faucet_package_address: NetworkAwarePackageAddress { - address: FAUCET_PACKAGE, - network_id, - }, - account_package_address: NetworkAwarePackageAddress { - address: ACCOUNT_PACKAGE, - network_id, - }, - xrd_resource_address: NetworkAwareResourceAddress { - address: RADIX_TOKEN, - network_id, - }, - system_token_resource_address: NetworkAwareResourceAddress { - address: SYSTEM_TOKEN, - network_id, - }, - ecdsa_secp256k1_token_resource_address: NetworkAwareResourceAddress { - address: ECDSA_SECP256K1_TOKEN, - network_id, - }, - eddsa_ed25519_token_resource_address: NetworkAwareResourceAddress { - address: EDDSA_ED25519_TOKEN, - network_id, - }, - package_token_resource_address: NetworkAwareResourceAddress { - address: PACKAGE_TOKEN, - network_id, - }, - epoch_manager_system_address: NetworkAwareComponentAddress { - address: EPOCH_MANAGER, - network_id, - }, - clock_system_address: NetworkAwareComponentAddress { - address: CLOCK, - network_id, - }, - }) - } - - fn post_process( - _: &KnownEntityAddressesRequest, - response: KnownEntityAddressesResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/mod.rs b/radix-engine-toolkit/src/request/mod.rs deleted file mode 100644 index 9e917904..00000000 --- a/radix-engine-toolkit/src/request/mod.rs +++ /dev/null @@ -1,92 +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. - -pub mod information; - -pub mod convert_manifest; - -pub mod compile_transaction_intent; -pub mod decompile_transaction_intent; - -pub mod compile_signed_transaction_intent; -pub mod decompile_signed_transaction_intent; - -pub mod compile_notarized_transaction; -pub mod decompile_notarized_transaction; - -pub mod decompile_unknown_intent; - -pub mod decode_address; -pub mod encode_address; - -pub mod sbor_decode; -pub mod sbor_encode; - -pub mod derive_babylon_address_from_olympia_address; -pub mod derive_babylon_resource_address_from_olympia_resource_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 information::*; - -pub use convert_manifest::*; - -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_babylon_resource_address_from_olympia_resource_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 analyze_manifest::*; -#[cfg(feature = "radix-engine")] -pub use analyze_manifest_with_preview_context::*; - -pub use known_entity_addresses::*; -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 deleted file mode 100644 index 0370e0b6..00000000 --- a/radix-engine-toolkit/src/request/sbor_decode.rs +++ /dev/null @@ -1,115 +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 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 -// ================= - -/// Takes in a byte array of SBOR byte and attempts to decode it to a [`Value`]. Since some of the -/// types in the [`Value`] model are network aware, this request also takes in a network id which -/// is primarily used for the Bech32m encoding of addresses. -#[serializable] -pub struct SborDecodeRequest { - /// A byte array serialized as a hex string of the SBOR buffer to attempt to decode as a - /// [`Value`] - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub encoded_value: Vec, - - /// An 8 bit unsigned integer serialized as a string which represents the id of the network - /// that the decoded data will be used on. This is primarily used for the Bech32m encoding of - /// addresses. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9]+"))] - #[serde_as(as = "serde_with::DisplayFromStr")] - pub network_id: u8, -} - -/// The response from the [`SborDecodeRequest`]. -#[serializable] -#[serde(tag = "type", content = "value")] -pub enum SborDecodeResponse { - ScryptoSbor(ScryptoSborValue), - ManifestSbor(ManifestSborValue), -} - -// =============== -// Implementation -// =============== - -pub struct SborDecodeHandler; - -impl Handler for SborDecodeHandler { - fn pre_process(request: SborDecodeRequest) -> Result { - Ok(request) - } - - fn handle(request: &SborDecodeRequest) -> Result { - 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, - response: SborDecodeResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/sbor_encode.rs b/radix-engine-toolkit/src/request/sbor_encode.rs deleted file mode 100644 index c0d71116..00000000 --- a/radix-engine-toolkit/src/request/sbor_encode.rs +++ /dev/null @@ -1,76 +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::Result; -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 -// ================= - -/// This request takes in a [`Value`] and attempts to SBOR encode it and return back an SBOR byte -/// array. -#[serializable] -#[serde(tag = "type", content = "value")] -pub enum SborEncodeRequest { - ScryptoSbor(ScryptoSborValue), - ManifestSbor(ManifestSborValue), -} - -/// The response from the [`SborEncodeRequest`]. -#[serializable] -pub struct SborEncodeResponse { - /// A byte array serialized as a hex string of the SBOR encoded value. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub encoded_value: Vec, -} - -// =============== -// Implementation -// =============== - -pub struct SborEncodeHandler; - -impl Handler for SborEncodeHandler { - fn pre_process(request: SborEncodeRequest) -> Result { - Ok(request) - } - - fn handle(request: &SborEncodeRequest) -> Result { - 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( - _: &SborEncodeRequest, - response: SborEncodeResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/statically_validate_transaction.rs b/radix-engine-toolkit/src/request/statically_validate_transaction.rs deleted file mode 100644 index beebe008..00000000 --- a/radix-engine-toolkit/src/request/statically_validate_transaction.rs +++ /dev/null @@ -1,106 +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::Result; -use crate::model::transaction::{InstructionKind, NotarizedTransaction}; -use crate::traits::CompilableIntent; -use native_transaction::validation::{ - NotarizedTransactionValidator, TestIntentHashManager, TransactionValidator, ValidationConfig, -}; -use toolkit_derive::serializable; - -use crate::request::traits::Handler; - -// ================= -// Model Definition -// ================= - -/// Performs static validation on the given notarized transaction. This request checks that: the -/// header is valid by ensuring that all elements of the header are valid, that the signatures are -/// valid, and that the manifest is valid. -#[serializable] -pub struct StaticallyValidateTransactionRequest { - /// A byte array serialized as a hex string which represents the compiled notarized intent - /// to perform static validation on. - #[schemars(with = "String")] - #[schemars(regex(pattern = "[0-9a-fA-F]+"))] - #[serde_as(as = "serde_with::hex::Hex")] - pub compiled_notarized_intent: Vec, - - /// The validation configuration which is the parameters and limits to use for the static - /// validation - #[schemars(with = "crate::model::transaction::ValidationConfig")] - #[serde_as(as = "serde_with::FromInto")] - pub validation_config: ValidationConfig, -} - -/// The response from [`StaticallyValidateTransactionRequest`]. -#[serializable] -#[serde(tag = "validity")] -#[derive(PartialEq, Eq)] -pub enum StaticallyValidateTransactionResponse { - Valid, - Invalid { error: String }, -} - -// =============== -// Implementation -// =============== - -pub struct StaticallyValidateTransactionHandler; - -impl Handler - for StaticallyValidateTransactionHandler -{ - fn pre_process( - request: StaticallyValidateTransactionRequest, - ) -> Result { - Ok(request) - } - - fn handle( - request: &StaticallyValidateTransactionRequest, - ) -> Result { - let notarized_transaction = NotarizedTransaction::decompile( - &request.compiled_notarized_intent, - InstructionKind::String, - )?; - - let intent_hash_manager = TestIntentHashManager::new(); - - if let Err(ref error) = NotarizedTransactionValidator::new(request.validation_config) - .validate( - ¬arized_transaction.to_native_notarized_transaction_intent()?, - request.compiled_notarized_intent.len(), - &intent_hash_manager, - ) - { - Ok(StaticallyValidateTransactionResponse::Invalid { - error: format!("{:?}", error), - }) - } else { - Ok(StaticallyValidateTransactionResponse::Valid) - } - } - - fn post_process( - _: &StaticallyValidateTransactionRequest, - response: StaticallyValidateTransactionResponse, - ) -> Result { - Ok(response) - } -} diff --git a/radix-engine-toolkit/src/request/traits.rs b/radix-engine-toolkit/src/request/traits.rs deleted file mode 100644 index e878b1c1..00000000 --- a/radix-engine-toolkit/src/request/traits.rs +++ /dev/null @@ -1,41 +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::Result; - -/// A trait describing request handlers - their main responsibility is handling request -/// preprocessing, handling, and postprocessing. -pub trait Handler { - /// Performs request preprocessing - example, validation of requests to ensure that values and - /// instructions all follow expected format. - fn pre_process(request: I) -> Result; - - /// The main request handler describing how to fulfill this request - fn handle(request: &I) -> Result; - - /// Performs all post processing of requests - example, aliasing values. - fn post_process(request: &I, response: O) -> Result; - - /// Fulfills the request by performing preprocessing, handling, and post processing - fn fulfill(request: I) -> Result { - // pre-process request - let request = Self::pre_process(request)?; - - // handle request and perform post-processing - Self::handle(&request).and_then(|response| Self::post_process(&request, response)) - } -} diff --git a/radix-engine-toolkit/src/utils.rs b/radix-engine-toolkit/src/utils.rs index 1dadb2db..cd749dfd 100644 --- a/radix-engine-toolkit/src/utils.rs +++ b/radix-engine-toolkit/src/utils.rs @@ -5,9 +5,9 @@ // 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 @@ -15,141 +15,76 @@ // specific language governing permissions and limitations // under the License. -use std::borrow::Borrow; - -use crate::error::{Error, Result}; -use bech32; -use scrypto::address::AddressError; -use scrypto::network::NetworkDefinition; -use scrypto::prelude::ComponentAddress; +use std::fmt::Debug; -/// 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 -pub fn network_definition_from_network_id(network_id: u8) -> NetworkDefinition { - match network_id { - 0x01 => NetworkDefinition::mainnet(), - 0x02 => NetworkDefinition { - id: network_id, - logical_name: "stokenet".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, +use serde::{de::DeserializeOwned, Deserialize, Serialize}; - 0x0A => NetworkDefinition { - id: network_id, - logical_name: "adapanet".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, - 0x0B => NetworkDefinition { - id: network_id, - logical_name: "nebunet".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, +use crate::{error::InvocationInterpretationError, memory::Pointer}; - 0x20 => NetworkDefinition { - id: network_id, - logical_name: "gilganet".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, - 0x21 => NetworkDefinition { - id: network_id, - logical_name: "enkinet".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, - 0x22 => NetworkDefinition { - id: network_id, - logical_name: "hammunet".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, - 0x23 => NetworkDefinition { - id: network_id, - logical_name: "nergalnet".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, - 0x24 => NetworkDefinition { - id: network_id, - logical_name: "mardunet".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, - - 0xF0 => NetworkDefinition { - id: network_id, - logical_name: "localnet".into(), - hrp_suffix: "loc".into(), - }, - 0xF1 => NetworkDefinition { - id: network_id, - logical_name: "inttestnet".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, - 0xF2 => NetworkDefinition::simulator(), - - _ => NetworkDefinition { - id: network_id, - logical_name: "unnamed".into(), - hrp_suffix: format!("tdx_{:x}_", network_id), - }, - } +pub fn debug_string(object: T) -> String { + format!("{:?}", object) } -pub fn network_id_from_hrp>(hrp: S) -> Result { - // Getting the network specifier from the given HRP. Bech32 HRPs used in Babylon are structured - // as follows: - let splitted_hrp = hrp.as_ref().split('_').collect::>(); - let network_specifier = { - match splitted_hrp.get(1) { - Some(_) => Ok(splitted_hrp - .into_iter() - .skip(1) - .collect::>() - .join("_")), - None => Err(AddressError::InvalidHrp), - } - }?; +pub fn serialize_and_write_to_memory( + object: &S, +) -> Result { + serde_json::to_string(object) + .map_err(|error| InvocationInterpretationError::SerializationError(debug_string(error))) + .map(|string| { + let object_bytes = string.as_bytes(); + let byte_count = object_bytes.len() + 1; + + unsafe { + let pointer = crate::memory::toolkit_alloc(byte_count); + pointer.copy_from( + [object_bytes, &[0]].concat().as_ptr() as Pointer, + byte_count, + ); - // Matching the network specifier to obtain the network id from it - let network_id = match network_specifier.as_str() { - "rdx" => NetworkDefinition::mainnet().id, - "sim" => NetworkDefinition::simulator().id, - "loc" => 0xF0, - numeric_network_specifier => { - match numeric_network_specifier.split('_').nth(1) { - Some(network_id_string) => Ok(u8::from_str_radix(network_id_string, 16) - .map_err(|_| AddressError::InvalidHrp)?), - None => Err(AddressError::InvalidHrp), + pointer } - }?, - }; - Ok(network_id) + }) } -pub fn network_id_from_address_string>(address: S) -> Result { - // Attempt to Bech32m decode this address to get the hrp and the data type (will not be used). - // The decoding process also yields a variant. We will not be verifying that this is bech32m - // since this method is not meant to be a validation method. - let (hrp, _, _) = - bech32::decode(address.as_ref()).map_err(AddressError::Bech32mDecodingError)?; - network_id_from_hrp(hrp) +pub fn read_and_deserialize_from_memory<'s, D: Deserialize<'s>>( + string_pointer: Pointer, +) -> Result { + unsafe { std::ffi::CStr::from_ptr(string_pointer as *const std::ffi::c_char) } + .to_str() + .map_err(|error| InvocationInterpretationError::Utf8Error(debug_string(error))) + .and_then(|string| { + serde_json::from_str(string).map_err(|error| { + InvocationInterpretationError::DeserializationError(debug_string(error)) + }) + }) } -pub fn is_account>(address: A) -> bool { - matches!( - address.borrow(), - ComponentAddress::Account(..) - | ComponentAddress::EcdsaSecp256k1VirtualAccount(..) - | ComponentAddress::EddsaEd25519VirtualAccount(..) - ) +pub fn serialize_to_jstring( + env: &jni::JNIEnv, + object: &S, +) -> Result { + serde_json::to_string(object) + .map_err(|error| InvocationInterpretationError::SerializationError(debug_string(error))) + .and_then(|string| { + env.new_string(string).map_err(|error| { + InvocationInterpretationError::FailedToAllocateJniString(debug_string(error)) + }) + }) + .map(|string| string.into_raw()) } -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) - } +pub fn deserialize_from_jstring( + env: &mut jni::JNIEnv, + jstring: &jni::objects::JString, +) -> Result { + let java_str = env.get_string(jstring).map_err(|error| { + InvocationInterpretationError::FailedToReadJniString(debug_string(error)) + })?; + + let string = String::from(java_str); + let result = serde_json::from_str(&string).map_err(|error| { + InvocationInterpretationError::DeserializationError(debug_string(error)) + })?; + + Ok(result) } diff --git a/radix-engine-toolkit/src/visitor/instruction/account_deposits_visitor.rs b/radix-engine-toolkit/src/visitor/instruction/account_deposits_visitor.rs deleted file mode 100644 index 7f474bbe..00000000 --- a/radix-engine-toolkit/src/visitor/instruction/account_deposits_visitor.rs +++ /dev/null @@ -1,497 +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(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 = - match self.resource_changes.get(&self.instruction_index) { - Some(resource_changes) => resource_changes - .iter() - .filter( - |ResourceChange { - node_id, amount, .. - }| { - *node_id - == RENodeId::GlobalObject( - radix_engine::types::Address::Component( - component_address.address, - ), - ) - && amount.is_positive() - }, - ) - .collect::>(), - None => Vec::new(), - }; - - 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 deleted file mode 100644 index 16b76c04..00000000 --- a/radix-engine-toolkit/src/visitor/instruction/account_interactions_visitor.rs +++ /dev/null @@ -1,170 +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 std::collections::BTreeSet; - -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 -#[derive(Debug, Default)] -pub struct AccountInteractionsInstructionVisitor { - pub auth_required: BTreeSet, - pub accounts_withdrawn_from: BTreeSet, - pub accounts_deposited_into: BTreeSet, -} - -impl AccountInteractionsInstructionVisitor { - const AUTH_REQUIRING_METHODS: &'static [&'static str] = &[ - 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 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 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 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::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::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::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 deleted file mode 100644 index c5e440c9..00000000 --- a/radix-engine-toolkit/src/visitor/instruction/account_proofs_visitor.rs +++ /dev/null @@ -1,78 +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 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 deleted file mode 100644 index cb154084..00000000 --- a/radix-engine-toolkit/src/visitor/instruction/account_withdraws_visitor.rs +++ /dev/null @@ -1,235 +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 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 deleted file mode 100644 index fe487c7e..00000000 --- a/radix-engine-toolkit/src/visitor/instruction/instruction_visitor.rs +++ /dev/null @@ -1,809 +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::Result; -use crate::model::instruction::Instruction; -use crate::visitor::{traverse_value, ManifestAstValueVisitor}; - -macro_rules! define_instruction_visitor { - ( - $(#[$meta:meta])* - $vis: vis trait $trait_ident: ident { - $($method_ident: ident ($($arg_ident: ident: $arg_type: ty),*)),* - } - ) => { - $(#[$meta])* - $vis trait $trait_ident { - $( - fn $method_ident(&mut self, $($arg_ident: $arg_type,)*) -> $crate::error::Result<()> { - Ok(()) - } - )* - } - }; -} - -macro_rules! visit { - ($visitors: expr, $method: ident, $($value: expr),*) => { - $visitors - .iter_mut() - .map(|visitor| visitor.$method($($value,)*)) - .collect::<$crate::error::Result>>() - }; -} - -define_instruction_visitor! { - /// An visitor which operates on [`crate::Instruction`]s. - pub trait InstructionVisitor { - visit_call_function( - _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::model::value::ast::ManifestAstValue, - _method_name: &mut crate::model::value::ast::ManifestAstValue, - _arguments: &mut Option> - ), - - visit_take_from_worktop( - _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::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::model::value::ast::ManifestAstValue, - _ids: &mut Vec, - _into_bucket: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_return_to_worktop( - _bucket: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_assert_worktop_contains( - _resource_address: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_assert_worktop_contains_by_amount( - _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::model::value::ast::ManifestAstValue, - _ids: &mut Vec - ), - - visit_pop_from_auth_zone( - _into_proof: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_push_to_auth_zone( - _proof: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_create_proof_from_auth_zone( - _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::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::model::value::ast::ManifestAstValue, - _ids: &mut Vec, - _into_proof: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_create_proof_from_bucket( - _bucket: &mut crate::model::value::ast::ManifestAstValue, - _into_proof: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_clone_proof( - _proof: &mut crate::model::value::ast::ManifestAstValue, - _into_proof: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_drop_proof( - _proof: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_publish_package( - _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::model::value::ast::ManifestAstValue - ), - - visit_recall_resource( - _vault_id: &mut crate::model::value::ast::ManifestAstValue, - _amount: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_set_metadata( - _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::model::value::ast::ManifestAstValue, - _royalty_config: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_set_component_royalty_config( - _component_address: &mut crate::model::value::ast::ManifestAstValue, - _royalty_config: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_claim_package_royalty( - _package_address: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_claim_component_royalty( - _component_address: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_set_method_access_rule( - _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::model::value::ast::ManifestAstValue, - _amount: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_mint_non_fungible( - _resource_address: &mut crate::model::value::ast::ManifestAstValue, - _entries: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_mint_uuid_non_fungible( - _resource_address: &mut crate::model::value::ast::ManifestAstValue, - _entries: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_create_fungible_resource( - _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::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::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::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::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::model::value::ast::ManifestAstValue - ), - - visit_assert_access_rule( - _access_rule: &mut crate::model::value::ast::ManifestAstValue - ), - - visit_create_validator( - _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_clear_signature_proofs(), - - post_visit() - } -} - -/// A function which traverses [`Instruction`]s calling the value visitors first and then calling -/// the instruction visitors -pub fn traverse_instruction( - instruction: &mut Instruction, - value_visitors: &mut [&mut dyn ManifestAstValueVisitor], - instructions_visitors: &mut [&mut dyn InstructionVisitor], -) -> Result<()> { - match instruction { - Instruction::CallFunction { - package_address, - blueprint_name, - function_name, - arguments, - } => { - traverse_value(package_address, value_visitors)?; - traverse_value(blueprint_name, value_visitors)?; - traverse_value(function_name, value_visitors)?; - if let Some(arguments) = arguments { - arguments - .iter_mut() - .map(|value| traverse_value(value, value_visitors)) - .collect::>>()?; - } - visit!( - instructions_visitors, - visit_call_function, - package_address, - blueprint_name, - function_name, - arguments - )?; - } - - Instruction::CallMethod { - component_address, - method_name, - arguments, - } => { - traverse_value(component_address, value_visitors)?; - traverse_value(method_name, value_visitors)?; - if let Some(arguments) = arguments { - arguments - .iter_mut() - .map(|value| traverse_value(value, value_visitors)) - .collect::>>()?; - } - visit!( - instructions_visitors, - visit_call_method, - component_address, - method_name, - arguments - )?; - } - - Instruction::TakeFromWorktop { - resource_address, - into_bucket, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(into_bucket, value_visitors)?; - visit!( - instructions_visitors, - visit_take_from_worktop, - resource_address, - into_bucket - )?; - } - - Instruction::TakeFromWorktopByAmount { - resource_address, - amount, - into_bucket, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(amount, value_visitors)?; - traverse_value(into_bucket, value_visitors)?; - visit!( - instructions_visitors, - visit_take_from_worktop_by_amount, - resource_address, - amount, - into_bucket - )?; - } - - Instruction::TakeFromWorktopByIds { - resource_address, - ids, - into_bucket, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(into_bucket, value_visitors)?; - ids.iter_mut() - .map(|value| traverse_value(value, value_visitors)) - .collect::>>()?; - visit!( - instructions_visitors, - visit_take_from_worktop_by_ids, - resource_address, - ids, - into_bucket - )?; - } - - Instruction::ReturnToWorktop { bucket } => { - traverse_value(bucket, value_visitors)?; - visit!(instructions_visitors, visit_return_to_worktop, bucket)?; - } - - Instruction::AssertWorktopContains { resource_address } => { - traverse_value(resource_address, value_visitors)?; - visit!( - instructions_visitors, - visit_assert_worktop_contains, - resource_address - )?; - } - - Instruction::AssertWorktopContainsByAmount { - resource_address, - amount, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(amount, value_visitors)?; - visit!( - instructions_visitors, - visit_assert_worktop_contains_by_amount, - resource_address, - amount - )?; - } - - Instruction::AssertWorktopContainsByIds { - resource_address, - ids, - } => { - traverse_value(resource_address, value_visitors)?; - ids.iter_mut() - .map(|value| traverse_value(value, value_visitors)) - .collect::>>()?; - visit!( - instructions_visitors, - visit_assert_worktop_contains_by_ids, - resource_address, - ids - )?; - } - - Instruction::PopFromAuthZone { into_proof } => { - traverse_value(into_proof, value_visitors)?; - visit!(instructions_visitors, visit_pop_from_auth_zone, into_proof)?; - } - - Instruction::PushToAuthZone { proof } => { - traverse_value(proof, value_visitors)?; - visit!(instructions_visitors, visit_push_to_auth_zone, proof)?; - } - - Instruction::CreateProofFromAuthZone { - resource_address, - into_proof, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(into_proof, value_visitors)?; - visit!( - instructions_visitors, - visit_create_proof_from_auth_zone, - resource_address, - into_proof - )?; - } - - Instruction::CreateProofFromAuthZoneByAmount { - resource_address, - amount, - into_proof, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(amount, value_visitors)?; - traverse_value(into_proof, value_visitors)?; - visit!( - instructions_visitors, - visit_create_proof_from_auth_zone_by_amount, - resource_address, - amount, - into_proof - )?; - } - - Instruction::CreateProofFromAuthZoneByIds { - resource_address, - ids, - into_proof, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(into_proof, value_visitors)?; - ids.iter_mut() - .map(|value| traverse_value(value, value_visitors)) - .collect::>>()?; - visit!( - instructions_visitors, - visit_create_proof_from_auth_zone_by_ids, - resource_address, - ids, - into_proof - )?; - } - - Instruction::CreateProofFromBucket { bucket, into_proof } => { - traverse_value(bucket, value_visitors)?; - traverse_value(into_proof, value_visitors)?; - visit!( - instructions_visitors, - visit_create_proof_from_bucket, - bucket, - into_proof - )?; - } - - Instruction::CloneProof { proof, into_proof } => { - traverse_value(proof, value_visitors)?; - traverse_value(into_proof, value_visitors)?; - visit!(instructions_visitors, visit_clone_proof, proof, into_proof)?; - } - - Instruction::DropProof { proof } => { - traverse_value(proof, value_visitors)?; - visit!(instructions_visitors, visit_drop_proof, proof)?; - } - - Instruction::PublishPackage { - code, - schema: abi, - royalty_config, - metadata, - access_rules, - } => { - traverse_value(code, value_visitors)?; - traverse_value(abi, value_visitors)?; - traverse_value(royalty_config, value_visitors)?; - traverse_value(metadata, value_visitors)?; - traverse_value(access_rules, value_visitors)?; - visit!( - instructions_visitors, - visit_publish_package, - code, - abi, - royalty_config, - metadata, - access_rules - )?; - } - - Instruction::BurnResource { bucket } => { - traverse_value(bucket, value_visitors)?; - visit!(instructions_visitors, visit_burn_resource, bucket)?; - } - - Instruction::RecallResource { vault_id, amount } => { - traverse_value(vault_id, value_visitors)?; - traverse_value(amount, value_visitors)?; - visit!( - instructions_visitors, - visit_recall_resource, - vault_id, - amount - )?; - } - - Instruction::SetMetadata { - entity_address, - key, - value, - } => { - traverse_value(entity_address, value_visitors)?; - traverse_value(key, value_visitors)?; - traverse_value(value, value_visitors)?; - visit!( - instructions_visitors, - visit_set_metadata, - entity_address, - key, - value - )?; - } - - 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, - } => { - traverse_value(package_address, value_visitors)?; - traverse_value(royalty_config, value_visitors)?; - visit!( - instructions_visitors, - visit_set_package_royalty_config, - package_address, - royalty_config - )?; - } - - Instruction::SetComponentRoyaltyConfig { - component_address, - royalty_config, - } => { - traverse_value(component_address, value_visitors)?; - traverse_value(royalty_config, value_visitors)?; - visit!( - instructions_visitors, - visit_set_component_royalty_config, - component_address, - royalty_config - )?; - } - - Instruction::ClaimPackageRoyalty { package_address } => { - traverse_value(package_address, value_visitors)?; - visit!( - instructions_visitors, - visit_claim_package_royalty, - package_address - )?; - } - - Instruction::ClaimComponentRoyalty { component_address } => { - traverse_value(component_address, value_visitors)?; - visit!( - instructions_visitors, - visit_claim_component_royalty, - component_address - )?; - } - - Instruction::SetMethodAccessRule { - entity_address, - key, - rule, - } => { - traverse_value(entity_address, value_visitors)?; - traverse_value(key, value_visitors)?; - traverse_value(rule, value_visitors)?; - visit!( - instructions_visitors, - visit_set_method_access_rule, - entity_address, - key, - rule - )?; - } - - Instruction::MintFungible { - resource_address, - amount, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(amount, value_visitors)?; - visit!( - instructions_visitors, - visit_mint_fungible, - resource_address, - amount - )?; - } - - Instruction::MintNonFungible { - resource_address, - entries, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(entries, value_visitors)?; - visit!( - instructions_visitors, - visit_mint_non_fungible, - resource_address, - entries - )?; - } - - Instruction::MintUuidNonFungible { - resource_address, - entries, - } => { - traverse_value(resource_address, value_visitors)?; - traverse_value(entries, value_visitors)?; - visit!( - instructions_visitors, - visit_mint_uuid_non_fungible, - resource_address, - entries - )?; - } - - Instruction::CreateFungibleResource { - divisibility, - metadata, - access_rules, - } => { - traverse_value(divisibility, value_visitors)?; - traverse_value(metadata, value_visitors)?; - traverse_value(access_rules, value_visitors)?; - visit!( - instructions_visitors, - visit_create_fungible_resource, - divisibility, - metadata, - access_rules - )?; - } - - Instruction::CreateFungibleResourceWithInitialSupply { - 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_with_owner, - divisibility, - metadata, - access_rules, - initial_supply - )?; - } - - Instruction::CreateNonFungibleResource { - id_type, - schema, - metadata, - access_rules, - } => { - traverse_value(id_type, value_visitors)?; - traverse_value(schema, value_visitors)?; - traverse_value(metadata, value_visitors)?; - traverse_value(access_rules, value_visitors)?; - visit!( - instructions_visitors, - visit_create_non_fungible_resource, - id_type, - schema, - metadata, - access_rules - )?; - } - - Instruction::CreateNonFungibleResourceWithInitialSupply { - 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_with_owner, - id_type, - schema, - metadata, - access_rules, - initial_supply - )?; - } - - Instruction::CreateAccessController { - controlled_asset, - rule_set, - timed_recovery_delay_in_minutes, - } => { - traverse_value(controlled_asset, 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, - rule_set, - timed_recovery_delay_in_minutes - )?; - } - - Instruction::CreateIdentity { access_rule } => { - traverse_value(access_rule, value_visitors)?; - visit!(instructions_visitors, visit_create_identity, access_rule)?; - } - - Instruction::AssertAccessRule { access_rule } => { - traverse_value(access_rule, value_visitors)?; - visit!(instructions_visitors, visit_assert_access_rule, access_rule)?; - } - - Instruction::CreateValidator { - key, - owner_access_rule, - } => { - traverse_value(key, value_visitors)?; - traverse_value(owner_access_rule, value_visitors)?; - visit!( - instructions_visitors, - visit_create_validator, - key, - owner_access_rule - )?; - } - - 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 deleted file mode 100644 index 627094c2..00000000 --- a/radix-engine-toolkit/src/visitor/instruction/mod.rs +++ /dev/null @@ -1,30 +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. - -#[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/mod.rs b/radix-engine-toolkit/src/visitor/mod.rs deleted file mode 100644 index 78c77228..00000000 --- a/radix-engine-toolkit/src/visitor/mod.rs +++ /dev/null @@ -1,22 +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 instruction; -mod value; - -pub use instruction::*; -pub use value::*; diff --git a/radix-engine-toolkit/src/visitor/value/address_aggregator_visitor.rs b/radix-engine-toolkit/src/visitor/value/address_aggregator_visitor.rs deleted file mode 100644 index 1b0eb3f9..00000000 --- a/radix-engine-toolkit/src/visitor/value/address_aggregator_visitor.rs +++ /dev/null @@ -1,72 +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 std::collections::BTreeSet; - -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 AddressAggregatorVisitor { - pub component_addresses: BTreeSet, - pub resource_addresses: BTreeSet, - pub package_addresses: BTreeSet, -} - -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(Error::Infallible { - message: "Expected component address!".into(), - }) - } - } - - 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(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 deleted file mode 100644 index 09db8824..00000000 --- a/radix-engine-toolkit/src/visitor/value/aliasing_visitor.rs +++ /dev/null @@ -1,85 +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; -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 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(ManifestAstValue::Address { - address: - EntityAddress::ResourceAddress { - address: resource_address, - }, - }), - Some(ManifestAstValue::NonFungibleLocalId { - value: non_fungible_local_id, - }), - ) if elements.len() == 2 => { - *value = ManifestAstValue::NonFungibleGlobalId { - resource_address: *resource_address, - non_fungible_local_id: non_fungible_local_id.clone(), - }; - Ok(()) - } - _ => Ok(()), - } - } else { - Err(Error::Infallible { - message: "Must be a tuple!".into(), - }) - } - } - - fn visit_array(&mut self, value: &mut ManifestAstValue) -> crate::error::Result<()> { - if let ManifestAstValue::Array { - ref elements, - element_kind: ManifestAstValueKind::U8, - } = value - { - // Case: Bytes - An array of u8 - let mut bytes = Vec::new(); - for element in elements.iter() { - match element { - 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 = ManifestAstValue::Bytes { value: bytes }; - Ok(()) - } else if let ManifestAstValue::Array { .. } = value { - Ok(()) - } else { - Err(Error::Infallible { - message: "Must be an array!".into(), - }) - } - } -} diff --git a/radix-engine-toolkit/src/visitor/value/mod.rs b/radix-engine-toolkit/src/visitor/value/mod.rs deleted file mode 100644 index bed1b2ce..00000000 --- a/radix-engine-toolkit/src/visitor/value/mod.rs +++ /dev/null @@ -1,26 +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. - -pub mod address_aggregator_visitor; -pub mod aliasing_visitor; -pub mod network_aggregator_visitor; -pub mod value_visitor; - -pub use address_aggregator_visitor::*; -pub use aliasing_visitor::*; -pub use network_aggregator_visitor::*; -pub use value_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 deleted file mode 100644 index b9245427..00000000 --- a/radix-engine-toolkit/src/visitor/value/network_aggregator_visitor.rs +++ /dev/null @@ -1,63 +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 std::collections::BTreeSet; - -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 -/// mismatches. -#[derive(Debug, Default)] -pub struct ValueNetworkAggregatorVisitor(pub BTreeSet); - -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(Error::Infallible { - message: "Expected non-fungible global id!".into(), - }) - } - } - - 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(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 deleted file mode 100644 index 9bc415b2..00000000 --- a/radix-engine-toolkit/src/visitor/value/value_visitor.rs +++ /dev/null @@ -1,207 +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::model::value::ast::{ManifestAstValue, ManifestAstValueKind}; - -macro_rules! define_value_visitor { - ( - $(#[$meta:meta])* - $vis: vis trait $trait_ident: ident { - $($method_ident: ident),* - } - ) => { - $(#[$meta])* - $vis trait $trait_ident { - $( - fn $method_ident(&mut self, _value: &mut $crate::model::value::ast::ManifestAstValue) -> $crate::error::Result<()> { - Ok(()) - } - )* - } - }; -} - -macro_rules! visit { - ($visitors: expr, $method: ident, $value: expr) => { - $visitors - .iter_mut() - .map(|visitor| visitor.$method($value)) - .collect::<$crate::error::Result>>() - }; -} - -define_value_visitor! { - /// 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 ManifestAstValueVisitor { - visit_bool, - - visit_u8, - visit_u16, - visit_u32, - visit_u64, - visit_u128, - - visit_i8, - visit_i16, - visit_i32, - visit_i64, - visit_i128, - - visit_string, - - visit_enum, - visit_some, - visit_none, - visit_ok, - visit_err, - - visit_array, - visit_map, - visit_tuple, - - visit_decimal, - visit_precise_decimal, - - visit_address, - - visit_bucket, - visit_proof, - - visit_non_fungible_global_id, - visit_non_fungible_local_id, - - visit_expression, - visit_blob, - visit_bytes - } -} - -pub fn traverse_value( - value: &mut crate::model::value::ast::ManifestAstValue, - visitors: &mut [&mut dyn ManifestAstValueVisitor], -) -> crate::error::Result<()> { - // Visit the top level value parts - match value.kind() { - ManifestAstValueKind::Bool => visit!(visitors, visit_bool, 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)?, - - 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)?, - - ManifestAstValueKind::String => visit!(visitors, visit_string, value)?, - - ManifestAstValueKind::Enum => visit!(visitors, visit_enum, 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)?, - - ManifestAstValueKind::Map => visit!(visitors, visit_map, value)?, - ManifestAstValueKind::Array => visit!(visitors, visit_array, value)?, - ManifestAstValueKind::Tuple => visit!(visitors, visit_tuple, value)?, - - ManifestAstValueKind::Decimal => visit!(visitors, visit_decimal, value)?, - ManifestAstValueKind::PreciseDecimal => visit!(visitors, visit_precise_decimal, value)?, - - ManifestAstValueKind::Address => visit!(visitors, visit_address, value)?, - - ManifestAstValueKind::Bucket => visit!(visitors, visit_bucket, value)?, - ManifestAstValueKind::Proof => visit!(visitors, visit_proof, value)?, - - ManifestAstValueKind::NonFungibleLocalId => { - visit!(visitors, visit_non_fungible_local_id, value)? - } - ManifestAstValueKind::NonFungibleGlobalId => { - visit!(visitors, visit_non_fungible_global_id, 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 `ManifestAstValue` inside of it should go here. - match value { - ManifestAstValue::Map { - entries: values, .. - } => { - values - .iter_mut() - .flat_map(|(x, y)| [x, y]) - .map(|value| traverse_value(value, visitors)) - .collect::>>()?; - } - ManifestAstValue::Enum { - fields: Some(values), - .. - } - | ManifestAstValue::Array { - elements: values, .. - } - | ManifestAstValue::Tuple { - elements: values, .. - } => { - values - .iter_mut() - .map(|value| traverse_value(value, visitors)) - .collect::>>()?; - } - ManifestAstValue::Some { value } - | ManifestAstValue::Ok { value } - | ManifestAstValue::Err { value } => { - traverse_value(value, visitors)?; - } - 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 deleted file mode 100644 index f5493ff1..00000000 --- a/radix-engine-toolkit/tests/aliasing.rs +++ /dev/null @@ -1,118 +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 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 = ManifestAstValue::Map { - key_value_kind: ManifestAstValueKind::String, - value_value_kind: ManifestAstValueKind::Tuple, - entries: vec![ - ( - ManifestAstValue::String { - value: "HelloWorld".into(), - }, - ManifestAstValue::Tuple { - elements: vec![ - ManifestAstValue::Decimal { - value: "12".parse().unwrap(), - }, - ManifestAstValue::PreciseDecimal { - value: "12".parse().unwrap(), - }, - ], - }, - ), - ( - ManifestAstValue::String { - value: "WorldHello".into(), - }, - 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)) } , - ] }], - }], - }], - }], - }], - }, - ), - ], - }; - - let expected = ManifestAstValue::Map { - key_value_kind: ManifestAstValueKind::String, - value_value_kind: ManifestAstValueKind::Tuple, - entries: vec![ - ( - ManifestAstValue::String { - value: "HelloWorld".into(), - }, - ManifestAstValue::Tuple { - elements: vec![ - ManifestAstValue::Decimal { - value: "12".parse().unwrap(), - }, - ManifestAstValue::PreciseDecimal { - value: "12".parse().unwrap(), - }, - ], - }, - ), - ( - ManifestAstValue::String { - value: "WorldHello".into(), - }, - 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)) - }], - }], - }], - }], - }], - }, - ), - ], - }; - - let mut visitor = ValueAliasingVisitor::default(); - - // Act - traverse_value(&mut value, &mut [&mut visitor]).unwrap(); - - // Assert - assert_eq!(expected, value) -} diff --git a/radix-engine-toolkit/tests/analyze_manifest_with_preview_context.rs b/radix-engine-toolkit/tests/analyze_manifest_with_preview_context.rs deleted file mode 100644 index b2e0b9a2..00000000 --- a/radix-engine-toolkit/tests/analyze_manifest_with_preview_context.rs +++ /dev/null @@ -1,41 +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 radix_engine_toolkit::{ - model::transaction::{InstructionList, TransactionManifest}, - request::{ - AnalyzeManifestWithPreviewContextHandler, AnalyzeManifestWithPreviewContextRequest, Handler, - }, -}; - -// TODO: Get receipts by doing local preview. -#[test] -pub fn x() { - let manifest = "CREATE_VALIDATOR Bytes(\"03c30ac032d7d808e6bfe571dcf4c6b048c0e389d3dbf0d72787e738c7fbf042d7\") Enum(\"AccessRule::Protected\", Enum(\"AccessRuleNode::ProofRule\", Enum(\"ProofRule::Require\", Enum(\"SoftResourceOrNonFungible::StaticResource\", Address(\"resource_tdx_c_1qt88fu7auuuje3fk4y89rhlz793rnef4p0n8f5795hkqpuaxf8\") ) ) ) ); CALL_METHOD Address(\"account_tdx_c_1p9sp696f5pwa446g832vej48flv2ujlyvjsxhkqfhp3q7r43xy\") \"deposit_batch\" Expression(\"ENTIRE_WORKTOP\");"; - let receipt = "5c2102220001210721022321214803220101800000000000000000000000000000000000000000000000000000012200002202012200000222070121032101230c2106064275636b65740421032022170e012022020001078301010a01000000000000000f01230720020022010001070701220101010a02000000000000000f01230720040022000122000222000322000e01202201000107a00e0120220101010a0500000000000000100222000107a0220001070a0e0120220101010a07000000000000000d0122000107c00e0120220101010a0900000000000000100222000107c0220001070a0e01202201000107910e01202201000107910e01202201000107910e01202201000107a00e0120220101010a07000000000000000e012022000e012022000e012022000e012022000e01202201000107a00e0120220101010a07000000000000000e01202201000107a00e0120220101010a0700000000000000202117022201010c124275636b6574496e666f5375627374617465220101220001200c02107265736f757263655f616464726573730d7265736f757263655f74797065022201010c0c5265736f75726365547970652201012201012307210200022201010c0846756e6769626c65220101220001200c010c64697669736962696c69747901022201010c0b4e6f6e46756e6769626c65220101220001200c010769645f74797065022201010c114e6f6e46756e6769626c654964547970652201012201012307210400022201010c06537472696e6722000001022201010c07496e746567657222000002022201010c05427974657322000003022201010c0455554944220000022201010c164c697175696446756e6769626c655265736f75726365220101220001200c0106616d6f756e74022201010c164c6f636b656446756e6769626c655265736f75726365220101220001200c0107616d6f756e747302220000220000022201010c194c69717569644e6f6e46756e6769626c655265736f75726365220101220001200c010369647302220000220000022201010c194c6f636b65644e6f6e46756e6769626c655265736f75726365220101220001200c010369647302220000220000022201010c0f4275636b65744275726e496e707574220101220001200c01066275636b6574022201010c144275636b657444726f70456d707479496e707574220101220001200c01066275636b6574022201010c0e4275636b6574507574496e707574220101220001200c01066275636b6574022201010c0f4275636b657454616b65496e707574220101220001200c0106616d6f756e74022201010c1b4275636b657454616b654e6f6e46756e6769626c6573496e707574220101220001200c0103696473022201010c144275636b6574476574416d6f756e74496e707574220101220001200c00022201010c214275636b65744765744e6f6e46756e6769626c654c6f63616c496473496e707574220101220001200c00022201010c1d4275636b65744765745265736f7572636541646472657373496e707574220101220001200c00022201010c164275636b657443726561746550726f6f66496e707574220101220001200c00022201010c154275636b65744c6f636b416d6f756e74496e707574220101220001200c0106616d6f756e74022201010c1b4275636b65744c6f636b4e6f6e46756e6769626c6573496e707574220101220001200c01096c6f63616c5f696473022201010c174275636b6574556e6c6f636b416d6f756e74496e707574220101220001200c0106616d6f756e74022201010c1d4275636b6574556e6c6f636b4e6f6e46756e6769626c6573496e707574220101220001200c01096c6f63616c5f6964732022170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020220501010a000000000000000001010a030000000000000001010a040000000000000001010a060000000000000001010a0800000000000000230c210d134275636b65745f6372656174655f70726f6f66042201012201002201010a120000000000000022000107920c134275636b65745f6372656174655f70726f6f66114275636b65745f64726f705f656d707479042200002201010a0b0000000000000022000107420c114275636b65745f64726f705f656d707479114275636b65745f6765745f616d6f756e74042201012200002201010a0f0000000000000022000107a00c114275636b65745f6765745f616d6f756e74214275636b65745f6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f696473042201012200002201010a10000000000000002201010a07000000000000000c214275636b65745f6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f6964731b4275636b65745f6765745f7265736f757263655f61646472657373042201012200002201010a110000000000000022000107830c1b4275636b65745f6765745f7265736f757263655f61646472657373124275636b65745f6c6f636b5f616d6f756e74042201012201002201010a130000000000000022000107420c124275636b65745f6c6f636b5f616d6f756e74194275636b65745f6c6f636b5f6e6f6e5f66756e6769626c6573042201012201002201010a140000000000000022000107420c194275636b65745f6c6f636b5f6e6f6e5f66756e6769626c65730a4275636b65745f707574042201012201002201010a0c0000000000000022000107420c0a4275636b65745f7075740b4275636b65745f74616b65042201012201002201010a0d0000000000000022000107910c0b4275636b65745f74616b65194275636b65745f74616b655f6e6f6e5f66756e6769626c6573042201012201002201010a0e0000000000000022000107910c194275636b65745f74616b655f6e6f6e5f66756e6769626c6573144275636b65745f756e6c6f636b5f616d6f756e74042201012201002201010a150000000000000022000107420c144275636b65745f756e6c6f636b5f616d6f756e741b4275636b65745f756e6c6f636b5f6e6f6e5f66756e6769626c6573042201012201002201010a160000000000000022000107420c1b4275636b65745f756e6c6f636b5f6e6f6e5f66756e6769626c65730b6275726e5f6275636b6574042200002201010a0a0000000000000022000107420c0b6275726e5f6275636b6574230c22001746756e6769626c655265736f757263654d616e616765720421032022250e012022030001078300010707000107a00e012022030001070701010a020000000000000001010a03000000000000001002220001070c220001070c10022201010a04000000000000002201010a05000000000000000f01230720070022000122000222000322000422000522000622000e0120220201010a060000000000000001010a06000000000000000f012307200300220001220002220101010a07000000000000000f012307200300220101010a080000000000000001220101010a130000000000000002220101010a13000000000000000f012307200500220101010a090000000000000001220201010a0e0000000000000001010a0f0000000000000002220201010a100000000000000001010a110000000000000003220101010a110000000000000004220101010a11000000000000000f012307200300220101010a0a000000000000000122010001078302220101010a0b000000000000000e0120220200010783000107c00e0120220101010a0c000000000000000d012201010a0d000000000000000f01230720020022010001070a0122010001070c0f0123072002002201000107a001220101010a0b000000000000000f01230720020022010001078301220101010a0b000000000000000f01230720020022010001070701220101010a0b000000000000000f012307200200220101010a120000000000000001220101010a0b000000000000000d012201010a09000000000000000d012201010a07000000000000000e012022040001070701010a020000000000000001010a0300000000000000000107a00e0120220200010783000107910e012022050001070701010a020000000000000001010a0300000000000000000107a001010a17000000000000000d0122000107070e01202201000107a00e01202201000107910e012022000e012022000e012022000f01230720020022010001070701220101010a1e000000000000000f01230720040022000122000222000322000e012022000e0120220101010a21000000000000000f01230720040022000122010001078002220101010a220000000000000003220101010a22000000000000000d0122000107070e01202201000107a00e01202201000107a0202125022201010c1f46756e6769626c655265736f757263654d616e616765725375627374617465220101220001200c03107265736f757263655f616464726573730c64697669736962696c6974790c746f74616c5f737570706c79022201010c2246756e6769626c655265736f757263654d616e61676572437265617465496e707574220101220001200c030c64697669736962696c697479086d657461646174610c6163636573735f72756c65730222000022000002220000220000022201010c155265736f757263654d6574686f64417574684b65792201012201012307210700022201010c044d696e7422000001022201010c044275726e22000002022201010c155570646174654e6f6e46756e6769626c654461746122000003022201010c0e5570646174654d6574616461746122000004022201010c08576974686472617722000005022201010c074465706f73697422000006022201010c06526563616c6c22000002220000220000022201010c0a41636365737352756c652201012201012307210300022201010c08416c6c6f77416c6c22000001022201010c0744656e79416c6c22000002022201010c0950726f746563746564220000022201010c0e41636365737352756c654e6f64652201012201012307210300022201010c0950726f6f6652756c6522000001022201010c05416e794f6622000002022201010c05416c6c4f66220000022201010c0950726f6f6652756c652201012201012307210500022201010c075265717569726522000001022201010c08416d6f756e744f6622000002022201010c07436f756e744f6622000003022201010c05416c6c4f6622000004022201010c05416e794f66220000022201010c19536f66745265736f757263654f724e6f6e46756e6769626c652201012201012307210300022201010c115374617469634e6f6e46756e6769626c6522000001022201010c0e5374617469635265736f7572636522000002022201010c0744796e616d6963220000022201010c134e6f6e46756e6769626c65476c6f62616c4964220000022201010c0a536368656d615061746822000002220000220000022201010c0d536368656d61537562506174682201012201012307210200022201010c05496e64657822000001022201010c054669656c64220000022201010c0b536f6674446563696d616c2201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c0c536f66745265736f757263652201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c09536f6674436f756e742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c1d536f66745265736f757263654f724e6f6e46756e6769626c654c6973742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d69632200000222000022000002220000220000022201010c3346756e6769626c655265736f757263654d616e6167657243726561746557697468496e697469616c537570706c79496e707574220101220001200c040c64697669736962696c697479086d657461646174610c6163636573735f72756c65730e696e697469616c5f737570706c7902220000220000022201010c3d46756e6769626c655265736f757263654d616e6167657243726561746557697468496e697469616c537570706c79416e6441646472657373496e707574220101220001200c050c64697669736962696c697479086d657461646174610c6163636573735f72756c65730e696e697469616c5f737570706c79107265736f757263655f61646472657373022201010c054279746573220000022201010c2046756e6769626c655265736f757263654d616e616765724d696e74496e707574220101220001200c0106616d6f756e74022201010c185265736f757263654d616e616765724275726e496e707574220101220001200c01066275636b6574022201010c205265736f757263654d616e616765724372656174654275636b6574496e707574220101220001200c00022201010c1f5265736f757263654d616e616765724372656174655661756c74496e707574220101220001200c00022201010c235265736f757263654d616e616765724765745265736f7572636554797065496e707574220101220001200c00022201010c0c5265736f75726365547970652201012201012307210200022201010c0846756e6769626c65220101220001200c010c64697669736962696c69747901022201010c0b4e6f6e46756e6769626c65220101220001200c010769645f74797065022201010c114e6f6e46756e6769626c654964547970652201012201012307210400022201010c06537472696e6722000001022201010c07496e746567657222000002022201010c05427974657322000003022201010c0455554944220000022201010c225265736f757263654d616e61676572476574546f74616c537570706c79496e707574220101220001200c00022201010c125661756c744372656174696f6e4576656e74220101220001200c01087661756c745f6964022201010c0852454e6f646549642201012201012307210400022201010c0d417574685a6f6e65537461636b22000001022201010c0c476c6f62616c4f626a65637422000002022201010c0d4b657956616c756553746f726522000003022201010c064f626a656374220000022201010c054279746573220000022201010c194d696e7446756e6769626c655265736f757263654576656e74220101220001200c0106616d6f756e74022201010c194275726e46756e6769626c655265736f757263654576656e74220101220001200c0106616d6f756e74202225000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c012102220101091a000000220101091a00000000000000000000000000000000000000000000000c012102220101091f000000220101091f0000000000000020220101010a0000000000000000230c2109046275726e042201012201002201010a190000000000000022000107420c1c6275726e5f46756e6769626c655265736f757263654d616e6167657206637265617465042200002201010a010000000000000022000107830c1e6372656174655f46756e6769626c655265736f757263654d616e616765720d6372656174655f6275636b6574042201012201002201010a1a0000000000000022000107910c256372656174655f6275636b65745f46756e6769626c655265736f757263654d616e616765720c6372656174655f7661756c74042201012201002201010a1b0000000000000022000107930c246372656174655f7661756c745f46756e6769626c655265736f757263654d616e616765721a6372656174655f776974685f696e697469616c5f737570706c79042200002201010a14000000000000002201010a15000000000000000c3e6372656174655f776974685f696e697469616c5f737570706c795f616e645f616464726573735f46756e6769626c655265736f757263654d616e61676572266372656174655f776974685f696e697469616c5f737570706c795f616e645f61646472657373042200002201010a16000000000000002201010a15000000000000000c326372656174655f776974685f696e697469616c5f737570706c795f46756e6769626c655265736f757263654d616e61676572116765745f7265736f757263655f74797065042201012200002201010a1c000000000000002201010a1d000000000000000c296765745f7265736f757263655f747970655f46756e6769626c655265736f757263654d616e61676572106765745f746f74616c5f737570706c79042201012200002201010a1f0000000000000022000107a00c286765745f746f74616c5f737570706c795f46756e6769626c655265736f757263654d616e61676572046d696e74042201012201002201010a180000000000000022000107910c1c6d696e745f46756e6769626c655265736f757263654d616e61676572230c2203194275726e46756e6769626c655265736f757263654576656e7401010a2400000000000000194d696e7446756e6769626c655265736f757263654576656e7401010a2300000000000000125661756c744372656174696f6e4576656e7401010a20000000000000001a4e6f6e46756e6769626c655265736f757263654d616e616765720421032022560e0120220600010783000107a001010a010000000000000001010a020000000000000001010a030000000000000001010a04000000000000000f01230720040022000122000222000322000f0123072002002201000107070122010001070a0d0122000107070d01220001070c0e0120220401010a010000000000000001010a060000000000000001010a2c0000000000000001010a2d000000000000000e0120220301010a070000000000000001010a020000000000000001010a04000000000000000e0120220301010a080000000000000001010a0d0000000000000001010a14000000000000000d012201010a09000000000000000f01230720120022000122000222000322000422000522000622000722000822000922000a22000b22000c22000d220101010a02000000000000000e220101010a0a000000000000000f220101010a0b0000000000000010220201010a020000000000000001010a020000000000000011220101010a0c000000000000000d012201010a0200000000000000100222000107072201010a0a000000000000000f012307200d0022000122000222000322000422000522000622000722000822000922000a22000b22000c22000d012201010a0e000000000000000e0120220201010a0f0000000000000001010a10000000000000000f01230720020022000122010001070c0f012307200200220001220101010a11000000000000000f012307200200220101010a120000000000000001220101010a13000000000000000d01220001070c100222000107072201010a0e000000000000000d012201010a15000000000000000f012307200f00220001220101010a160000000000000002220101010a180000000000000003220101010a1a0000000000000004220101010a1c0000000000000005220101010a1e0000000000000006220101010a200000000000000007220101010a220000000000000008220101010a240000000000000009220101010a26000000000000000a220101010a28000000000000000b220101010a2a000000000000000c220101010a2a000000000000000d220101010a2a000000000000000e220101010a2b000000000000000e0120220201010a170000000000000001010a17000000000000000f0123072002002200012201000107020e0120220201010a190000000000000001010a19000000000000000f0123072002002200012201000107030e0120220201010a1b0000000000000001010a1b000000000000000f0123072002002200012201000107040e0120220201010a1d0000000000000001010a1d000000000000000f0123072002002200012201000107050e0120220201010a1f0000000000000001010a1f000000000000000f0123072002002200012201000107060e0120220201010a210000000000000001010a21000000000000000f0123072002002200012201000107070e0120220201010a230000000000000001010a23000000000000000f0123072002002200012201000107080e0120220201010a250000000000000001010a25000000000000000f0123072002002200012201000107090e0120220201010a270000000000000001010a27000000000000000f01230720020022000122010001070a0e0120220201010a290000000000000001010a29000000000000000f01230720020022000122010001070b0e0120220201010a250000000000000001010a25000000000000000f01230720001002220001070c220001070c10022201010a2e000000000000002201010a2f000000000000000f01230720070022000122000222000322000422000522000622000e0120220201010a300000000000000001010a30000000000000000f012307200300220001220002220101010a31000000000000000f012307200300220101010a320000000000000001220101010a3d0000000000000002220101010a3d000000000000000f012307200500220101010a330000000000000001220201010a380000000000000001010a390000000000000002220201010a3a0000000000000001010a3b0000000000000003220101010a3b0000000000000004220101010a3b000000000000000f012307200300220101010a34000000000000000122010001078302220101010a35000000000000000e0120220200010783000107c00e0120220101010a36000000000000000d012201010a37000000000000000f01230720020022010001070a0122010001070c0f0123072002002201000107a001220101010a35000000000000000f01230720020022010001078301220101010a35000000000000000f01230720020022010001070701220101010a35000000000000000f012307200200220101010a3c0000000000000001220101010a35000000000000000d012201010a33000000000000000d012201010a31000000000000000e0120220501010a010000000000000001010a060000000000000001010a2c0000000000000001010a2d0000000000000001010a3f000000000000000d0122000107070e0120220501010a010000000000000001010a060000000000000001010a2c0000000000000001010a2d0000000000000001010a4100000000000000100222000107c02201010a42000000000000000e01202201000107400e0120220200010783000107910e0120220401010a060000000000000001010a2c0000000000000001010a2d0000000000000001010a45000000000000000d012201010a42000000000000000e0120220101010a41000000000000000e01202201000107c00e01202203000107c00001070c000107400e01202201000107c00e0120220101010a45000000000000000e012022000e01202201000107910e012022000e012022000f01230720020022010001070701220101010a01000000000000000e012022000e0120220101010a52000000000000000f01230720040022000122010001078002220101010a030000000000000003220101010a03000000000000000e0120220101010a54000000000000000d0122000107c00e0120220101010a5400000000000000202156022201010c224e6f6e46756e6769626c655265736f757263654d616e616765725375627374617465220101220001200c06107265736f757263655f616464726573730c746f74616c5f737570706c790769645f74797065176e6f6e5f66756e6769626c655f747970655f696e646578126e6f6e5f66756e6769626c655f7461626c650e6d757461626c655f6669656c6473022201010c114e6f6e46756e6769626c654964547970652201012201012307210400022201010c06537472696e6722000001022201010c07496e746567657222000002022201010c05427974657322000003022201010c0455554944220000022201010c0e4c6f63616c54797065496e6465782201012201012307210200022201010c0957656c6c4b6e6f776e22000001022201010c10536368656d614c6f63616c496e646578220000022201010c05427974657322000002220000220000022201010c254e6f6e46756e6769626c655265736f757263654d616e61676572437265617465496e707574220101220001200c040769645f74797065136e6f6e5f66756e6769626c655f736368656d61086d657461646174610c6163636573735f72756c6573022201010c154e6f6e46756e6769626c6544617461536368656d61220101220001200c0306736368656d610c6e6f6e5f66756e6769626c650e6d757461626c655f6669656c6473022201010c06536368656d61220101220001200c030a747970655f6b696e64730d747970655f6d6574616461746110747970655f76616c69646174696f6e7302220000220000022201010c08547970654b696e642201012201012307211200022201010c03416e7922000001022201010c04426f6f6c22000002022201010c02493822000003022201010c0349313622000004022201010c0349333222000005022201010c0349363422000006022201010c044931323822000007022201010c02553822000008022201010c0355313622000009022201010c035533322200000a022201010c035536342200000b022201010c04553132382200000c022201010c06537472696e672200000d022201010c054172726179220101220001200c010c656c656d656e745f747970650e022201010c055475706c65220101220001200c010b6669656c645f74797065730f022201010c04456e756d220101220001200c010876617269616e747310022201010c034d6170220101220001200c02086b65795f747970650a76616c75655f7479706511022201010c06437573746f6d2200000222000022000002220000220000022201010c155363727970746f437573746f6d547970654b696e642201012201012307210d00022201010c074164647265737322000001022201010c0e5061636b6167654164647265737322000002022201010c10436f6d706f6e656e744164647265737322000003022201010c0f5265736f757263654164647265737322000004022201010c034f776e22000005022201010c064275636b657422000006022201010c0550726f6f6622000007022201010c055661756c7422000008022201010c0d4b657956616c756553746f726522000009022201010c07446563696d616c2200000a022201010c0e50726563697365446563696d616c2200000b022201010c124e6f6e46756e6769626c654c6f63616c49642200000c022201010c095265666572656e636522000002220000220000022201010c0c547970654d65746164617461220101220001200c0209747970655f6e616d650b6368696c645f6e616d6573022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c0a4368696c644e616d65732201012201012307210200022201010c0b4e616d65644669656c647322000001022201010c0c456e756d56617269616e7473220000022200002200000222000022000002220000220000022201010c0e5479706556616c69646174696f6e2201012201012307210f00022201010c044e6f6e6522000001022201010c02493822000002022201010c0349313622000003022201010c0349333222000004022201010c0349363422000005022201010c044931323822000006022201010c02553822000007022201010c0355313622000008022201010c0355333222000009022201010c035536342200000a022201010c04553132382200000b022201010c06537472696e672200000c022201010c0541727261792200000d022201010c034d61702200000e022201010c06437573746f6d220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c114e756d6572696356616c69646174696f6e220101220001200c02036d696e036d6178022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c104c656e67746856616c69646174696f6e220101220001200c02036d696e036d6178022201010c1b5363727970746f437573746f6d5479706556616c69646174696f6e220101220101230721000222000022000002220000220000022201010c155265736f757263654d6574686f64417574684b65792201012201012307210700022201010c044d696e7422000001022201010c044275726e22000002022201010c155570646174654e6f6e46756e6769626c654461746122000003022201010c0e5570646174654d6574616461746122000004022201010c08576974686472617722000005022201010c074465706f73697422000006022201010c06526563616c6c22000002220000220000022201010c0a41636365737352756c652201012201012307210300022201010c08416c6c6f77416c6c22000001022201010c0744656e79416c6c22000002022201010c0950726f746563746564220000022201010c0e41636365737352756c654e6f64652201012201012307210300022201010c0950726f6f6652756c6522000001022201010c05416e794f6622000002022201010c05416c6c4f66220000022201010c0950726f6f6652756c652201012201012307210500022201010c075265717569726522000001022201010c08416d6f756e744f6622000002022201010c07436f756e744f6622000003022201010c05416c6c4f6622000004022201010c05416e794f66220000022201010c19536f66745265736f757263654f724e6f6e46756e6769626c652201012201012307210300022201010c115374617469634e6f6e46756e6769626c6522000001022201010c0e5374617469635265736f7572636522000002022201010c0744796e616d6963220000022201010c134e6f6e46756e6769626c65476c6f62616c4964220000022201010c0a536368656d615061746822000002220000220000022201010c0d536368656d61537562506174682201012201012307210200022201010c05496e64657822000001022201010c054669656c64220000022201010c0b536f6674446563696d616c2201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c0c536f66745265736f757263652201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c09536f6674436f756e742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c1d536f66745265736f757263654f724e6f6e46756e6769626c654c6973742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d69632200000222000022000002220000220000022201010c304e6f6e46756e6769626c655265736f757263654d616e616765724372656174655769746841646472657373496e707574220101220001200c050769645f74797065136e6f6e5f66756e6769626c655f736368656d61086d657461646174610c6163636573735f72756c6573107265736f757263655f61646472657373022201010c054279746573220000022201010c364e6f6e46756e6769626c655265736f757263654d616e6167657243726561746557697468496e697469616c537570706c79496e707574220101220001200c050769645f74797065136e6f6e5f66756e6769626c655f736368656d61086d657461646174610c6163636573735f72756c657307656e7472696573022200002200000222000022000002220000220000022201010c3a4e6f6e46756e6769626c655265736f757263654d616e616765724372656174655575696457697468496e697469616c537570706c79496e707574220101220001200c04136e6f6e5f66756e6769626c655f736368656d61086d657461646174610c6163636573735f72756c657307656e747269657302220000220000022201010c234e6f6e46756e6769626c655265736f757263654d616e616765724d696e74496e707574220101220001200c0107656e7472696573022201010c2d4e6f6e46756e6769626c655265736f757263654d616e616765724765744e6f6e46756e6769626c65496e707574220101220001200c01026964022201010c294e6f6e46756e6769626c655265736f757263654d616e6167657255706461746544617461496e707574220101220001200c030269640a6669656c645f6e616d650464617461022201010c254e6f6e46756e6769626c655265736f757263654d616e61676572457869737473496e707574220101220001200c01026964022201010c274e6f6e46756e6769626c655265736f757263654d616e616765724d696e7455756964496e707574220101220001200c0107656e7472696573022201010c205265736f757263654d616e616765724372656174654275636b6574496e707574220101220001200c00022201010c185265736f757263654d616e616765724275726e496e707574220101220001200c01066275636b6574022201010c1f5265736f757263654d616e616765724372656174655661756c74496e707574220101220001200c00022201010c235265736f757263654d616e616765724765745265736f7572636554797065496e707574220101220001200c00022201010c0c5265736f75726365547970652201012201012307210200022201010c0846756e6769626c65220101220001200c010c64697669736962696c69747901022201010c0b4e6f6e46756e6769626c65220101220001200c010769645f74797065022201010c225265736f757263654d616e61676572476574546f74616c537570706c79496e707574220101220001200c00022201010c125661756c744372656174696f6e4576656e74220101220001200c01087661756c745f6964022201010c0852454e6f646549642201012201012307210400022201010c0d417574685a6f6e65537461636b22000001022201010c0c476c6f62616c4f626a65637422000002022201010c0d4b657956616c756553746f726522000003022201010c064f626a656374220000022201010c1c4d696e744e6f6e46756e6769626c655265736f757263654576656e74220101220001200c010369647302220000220000022201010c1c4275726e4e6f6e46756e6769626c655265736f757263654576656e74220101220001200c01036964732022560000000000000c012102220101091f000000220101091f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c012102220101091a000000220101091a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020220101010a0000000000000000230c210e046275726e042201012201002201010a4c0000000000000022000107420c1f6275726e5f4e6f6e46756e6769626c655265736f757263654d616e6167657206637265617465042200002201010a050000000000000022000107830c216372656174655f4e6f6e46756e6769626c655265736f757263654d616e616765720d6372656174655f6275636b6574042201012201002201010a4b0000000000000022000107910c286372656174655f6275636b65745f4e6f6e46756e6769626c655265736f757263654d616e61676572206372656174655f6e6f6e5f66756e6769626c655f776974685f61646472657373042200002201010a3e0000000000000022000107830c206372656174655f6e6f6e5f66756e6769626c655f776974685f616464726573732c6372656174655f757569645f6e6f6e5f66756e6769626c655f776974685f696e697469616c5f737570706c79042200002201010a44000000000000002201010a43000000000000000c2c6372656174655f757569645f6e6f6e5f66756e6769626c655f776974685f696e697469616c5f737570706c790c6372656174655f7661756c74042201012201002201010a4d0000000000000022000107930c276372656174655f7661756c745f4e6f6e46756e6769626c655265736f757263654d616e616765721a6372656174655f776974685f696e697469616c5f737570706c79042200002201010a40000000000000002201010a43000000000000000c356372656174655f776974685f696e697469616c5f737570706c795f4e6f6e46756e6769626c655265736f757263654d616e61676572106765745f6e6f6e5f66756e6769626c65042201012200002201010a470000000000000022000107400c106765745f6e6f6e5f66756e6769626c65116765745f7265736f757263655f74797065042201012200002201010a4e000000000000002201010a4f000000000000000c2c6765745f7265736f757263655f747970655f4e6f6e46756e6769626c655265736f757263654d616e61676572106765745f746f74616c5f737570706c79042201012200002201010a500000000000000022000107a00c2b6765745f746f74616c5f737570706c795f4e6f6e46756e6769626c655265736f757263654d616e61676572046d696e74042201012201002201010a460000000000000022000107910c1f6d696e745f4e6f6e46756e6769626c655265736f757263654d616e61676572096d696e745f75756964042201012201002201010a4a0000000000000022000107910c246d696e745f757569645f4e6f6e46756e6769626c655265736f757263654d616e61676572136e6f6e5f66756e6769626c655f657869737473042201012201002201010a490000000000000022000107010c136e6f6e5f66756e6769626c655f657869737473187570646174655f6e6f6e5f66756e6769626c655f64617461042201012201002201010a480000000000000022000107420c187570646174655f6e6f6e5f66756e6769626c655f64617461230c22031c4275726e4e6f6e46756e6769626c655265736f757263654576656e7401010a55000000000000001c4d696e744e6f6e46756e6769626c655265736f757263654576656e7401010a5300000000000000125661756c744372656174696f6e4576656e7401010a51000000000000000550726f6f6604210320220f0e012022030001078301010a0100000000000000000107010f01230720020022010001070701220101010a02000000000000000f01230720040022000122000222000322000e01202202000107a001010a040000000000000010022201010a050000000000000022000107a00f012307200200220101010a060000000000000001220101010a06000000000000000d0122000107070e0120220201010a080000000000000001010a09000000000000000d0122000107c010022201010a05000000000000002201010a08000000000000000e01202201000107920e012022000e012022000e012022000e0120220020210f022201010c1150726f6f66496e666f5375627374617465220101220001200c03107265736f757263655f616464726573730d7265736f757263655f747970650a72657374726963746564022201010c0c5265736f75726365547970652201012201012307210200022201010c0846756e6769626c65220101220001200c010c64697669736962696c69747901022201010c0b4e6f6e46756e6769626c65220101220001200c010769645f74797065022201010c114e6f6e46756e6769626c654964547970652201012201012307210400022201010c06537472696e6722000001022201010c07496e746567657222000002022201010c05427974657322000003022201010c0455554944220000022201010c0d46756e6769626c6550726f6f66220101220001200c020c746f74616c5f6c6f636b65640865766964656e636502220000220000022201010c084c6f63616c5265662201012201012307210200022201010c064275636b657422000001022201010c055661756c74220000022201010c054279746573220000022201010c104e6f6e46756e6769626c6550726f6f66220101220001200c020c746f74616c5f6c6f636b65640865766964656e63650222000022000002220000220000022201010c0e50726f6f6644726f70496e707574220101220001200c010570726f6f66022201010c0f50726f6f66436c6f6e65496e707574220101220001200c00022201010c1350726f6f66476574416d6f756e74496e707574220101220001200c00022201010c2050726f6f664765744e6f6e46756e6769626c654c6f63616c496473496e707574220101220001200c00022201010c1c50726f6f664765745265736f7572636541646472657373496e707574220101220001200c0020220f0000000000000000000000000c012102220101091f000000220101091f0000000000000000000000000000000000000020220301010a000000000000000001010a030000000000000001010a0700000000000000230c21050a50726f6f665f64726f70042200002201010a0a0000000000000022000107420c0a50726f6f665f64726f701050726f6f665f6765745f616d6f756e74042201012200002201010a0c0000000000000022000107a00c1050726f6f665f6765745f616d6f756e742050726f6f665f6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f696473042201012200002201010a0d000000000000002201010a08000000000000000c2050726f6f665f6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f6964731a50726f6f665f6765745f7265736f757263655f61646472657373042201012200002201010a0e0000000000000022000107830c1a50726f6f665f6765745f7265736f757263655f6164647265737305636c6f6e65042201012201002201010a0b0000000000000022000107920c05636c6f6e65230c2200055661756c7404210320221e0e012022020001078301010a01000000000000000f01230720020022010001070701220101010a02000000000000000f01230720040022000122000222000322000e01202201000107a00e0120220101010a0500000000000000100222000107a0220001070a0e0120220101010a07000000000000000d0122000107c00e0120220101010a0900000000000000100222000107c0220001070a0e01202202000107a0000107010e01202201000107a00e0120220101010a07000000000000000e01202201000107a00e0120220101010a07000000000000000e01202201000107910e012022000e012022000e012022000e012022000e01202201000107a00e0120220101010a07000000000000000e01202201000107a00e0120220101010a07000000000000000e01202201000107a00e0120220101010a07000000000000000e01202201000107a00f0123072002002201000107a001220101010a07000000000000000f0123072002002201000107a001220101010a07000000000000000f0123072002002201000107a001220101010a070000000000000020211e022201010c115661756c74496e666f5375627374617465220101220001200c02107265736f757263655f616464726573730d7265736f757263655f74797065022201010c0c5265736f75726365547970652201012201012307210200022201010c0846756e6769626c65220101220001200c010c64697669736962696c69747901022201010c0b4e6f6e46756e6769626c65220101220001200c010769645f74797065022201010c114e6f6e46756e6769626c654964547970652201012201012307210400022201010c06537472696e6722000001022201010c07496e746567657222000002022201010c05427974657322000003022201010c0455554944220000022201010c164c697175696446756e6769626c655265736f75726365220101220001200c0106616d6f756e74022201010c164c6f636b656446756e6769626c655265736f75726365220101220001200c0107616d6f756e747302220000220000022201010c194c69717569644e6f6e46756e6769626c655265736f75726365220101220001200c010369647302220000220000022201010c194c6f636b65644e6f6e46756e6769626c655265736f75726365220101220001200c010369647302220000220000022201010c115661756c744c6f636b466565496e707574220101220001200c0206616d6f756e740a636f6e74696e67656e74022201010c0e5661756c7454616b65496e707574220101220001200c0106616d6f756e74022201010c1a5661756c7454616b654e6f6e46756e6769626c6573496e707574220101220001200c01166e6f6e5f66756e6769626c655f6c6f63616c5f696473022201010c105661756c74526563616c6c496e707574220101220001200c0106616d6f756e74022201010c1c5661756c74526563616c6c4e6f6e46756e6769626c6573496e707574220101220001200c01166e6f6e5f66756e6769626c655f6c6f63616c5f696473022201010c0d5661756c74507574496e707574220101220001200c01066275636b6574022201010c135661756c74476574416d6f756e74496e707574220101220001200c00022201010c1c5661756c744765745265736f7572636541646472657373496e707574220101220001200c00022201010c205661756c744765744e6f6e46756e6769626c654c6f63616c496473496e707574220101220001200c00022201010c155661756c7443726561746550726f6f66496e707574220101220001200c00022201010c1d5661756c7443726561746550726f6f664279416d6f756e74496e707574220101220001200c0106616d6f756e74022201010c1a5661756c7443726561746550726f6f664279496473496e707574220101220001200c0103696473022201010c145661756c744c6f636b416d6f756e74496e707574220101220001200c0106616d6f756e74022201010c1a5661756c744c6f636b4e6f6e46756e6769626c6573496e707574220101220001200c01096c6f63616c5f696473022201010c165661756c74556e6c6f636b416d6f756e74496e707574220101220001200c0106616d6f756e74022201010c1c5661756c74556e6c6f636b4e6f6e46756e6769626c6573496e707574220101220001200c01096c6f63616c5f696473022201010c0c4c6f636b4665654576656e74220101220001200c0106616d6f756e74022201010c1557697468647261775265736f757263654576656e742201012201012307210200022201010c06416d6f756e7422000001022201010c03496473220000022201010c144465706f7369745265736f757263654576656e742201012201012307210200022201010c06416d6f756e7422000001022201010c03496473220000022201010c13526563616c6c5265736f757263654576656e742201012201012307210200022201010c06416d6f756e7422000001022201010c0349647322000020221e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020220501010a000000000000000001010a030000000000000001010a040000000000000001010a060000000000000001010a0800000000000000230c2110115661756c745f6c6f636b5f616d6f756e74042201012201002201010a160000000000000022000107420c115661756c745f6c6f636b5f616d6f756e74185661756c745f6c6f636b5f6e6f6e5f66756e6769626c6573042201012201002201010a170000000000000022000107420c185661756c745f6c6f636b5f6e6f6e5f66756e6769626c6573135661756c745f756e6c6f636b5f616d6f756e74042201012201002201010a180000000000000022000107420c135661756c745f756e6c6f636b5f616d6f756e741a5661756c745f756e6c6f636b5f6e6f6e5f66756e6769626c6573042201012201002201010a190000000000000022000107420c1a5661756c745f756e6c6f636b5f6e6f6e5f66756e6769626c65730c6372656174655f70726f6f66042201012201002201010a130000000000000022000107920c0c6372656174655f70726f6f66166372656174655f70726f6f665f62795f616d6f756e74042201012201002201010a140000000000000022000107920c166372656174655f70726f6f665f62795f616d6f756e74136372656174655f70726f6f665f62795f696473042201012201002201010a150000000000000022000107920c136372656174655f70726f6f665f62795f6964730a6765745f616d6f756e74042201012200002201010a100000000000000022000107a00c0a6765745f616d6f756e741a6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f696473042201012200002201010a12000000000000002201010a07000000000000000c1a6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f696473146765745f7265736f757263655f61646472657373042201012200002201010a110000000000000022000107830c146765745f7265736f757263655f61646472657373086c6f636b5f666565042201012201002201010a0a0000000000000022000107420c086c6f636b5f66656503707574042201012201002201010a0f0000000000000022000107420c0370757406726563616c6c042201012201002201010a0d0000000000000022000107910c06726563616c6c14726563616c6c5f6e6f6e5f66756e6769626c6573042201012201002201010a0e0000000000000022000107910c14726563616c6c5f6e6f6e5f66756e6769626c65730474616b65042201012201002201010a0b0000000000000022000107910c0474616b651274616b655f6e6f6e5f66756e6769626c6573042201012201002201010a0c0000000000000022000107910c1274616b655f6e6f6e5f66756e6769626c6573230c2204144465706f7369745265736f757263654576656e7401010a1c000000000000000c4c6f636b4665654576656e7401010a1a0000000000000013526563616c6c5265736f757263654576656e7401010a1d000000000000001557697468647261775265736f757263654576656e7401010a1b0000000000000007576f726b746f7004210320220d0e0120220101010a01000000000000001002220001078322000107900e01202201000107900e01202201000107910e01202202000107a0000107830e0120220201010a0600000000000000000107830d0122000107c00e01202201000107830e01202201000107830e0120220200010783000107a00e012022020001078301010a06000000000000000e012022000d01220001079120210d022201010c0f576f726b746f705375627374617465220101220001200c01097265736f757263657302220000220000022201010c10576f726b746f7044726f70496e707574220101220001200c0107776f726b746f70022201010c0f576f726b746f70507574496e707574220101220001200c01066275636b6574022201010c10576f726b746f7054616b65496e707574220101220001200c0206616d6f756e74107265736f757263655f61646472657373022201010c1c576f726b746f7054616b654e6f6e46756e6769626c6573496e707574220101220001200c0203696473107265736f757263655f6164647265737302220000220000022201010c13576f726b746f7054616b65416c6c496e707574220101220001200c01107265736f757263655f61646472657373022201010c1a576f726b746f70417373657274436f6e7461696e73496e707574220101220001200c01107265736f757263655f61646472657373022201010c20576f726b746f70417373657274436f6e7461696e73416d6f756e74496e707574220101220001200c02107265736f757263655f6164647265737306616d6f756e74022201010c26576f726b746f70417373657274436f6e7461696e734e6f6e46756e6769626c6573496e707574220101220001200c02107265736f757263655f6164647265737303696473022201010c11576f726b746f70447261696e496e707574220101220001200c000222000022000020220d000000000000000000000000000000000000000000000000000020220101010a0000000000000000230c210917576f726b746f705f6173736572745f636f6e7461696e73042201012201002201010a080000000000000022000107420c17576f726b746f705f6173736572745f636f6e7461696e731e576f726b746f705f6173736572745f636f6e7461696e735f616d6f756e74042201012201002201010a090000000000000022000107420c1e576f726b746f705f6173736572745f636f6e7461696e735f616d6f756e7425576f726b746f705f6173736572745f636f6e7461696e735f6e6f6e5f66756e6769626c6573042201012201002201010a0a0000000000000022000107420c25576f726b746f705f6173736572745f636f6e7461696e735f6e6f6e5f66756e6769626c65730d576f726b746f705f647261696e042201012201002201010a0b000000000000002201010a0c000000000000000c0d576f726b746f705f647261696e0c576f726b746f705f64726f70042200002201010a020000000000000022000107420c0c576f726b746f705f64726f700b576f726b746f705f707574042201012201002201010a030000000000000022000107420c0b576f726b746f705f7075740c576f726b746f705f74616b65042201012201002201010a040000000000000022000107910c0c576f726b746f705f74616b6510576f726b746f705f74616b655f616c6c042201012201002201010a070000000000000022000107910c10576f726b746f705f74616b655f616c6c1a576f726b746f705f74616b655f6e6f6e5f66756e6769626c6573042201012201002201010a050000000000000022000107910c1a576f726b746f705f74616b655f6e6f6e5f66756e6769626c6573230c2200208000208000090100000003220101800000000000000000000000000000000000000000000000000000012200002202012201000222080122010009010000000322010180000000000000000000000000000000000000000000000000000001220000220201220200022209012101200701010901000000032201018000000000000000000000000000000000000000000000000000000122000022020122030002220a012102220000230c21000901000000032201018000000000000000000000000000000000000000000000000000000122000022020122040002220b01210223212200220000090100000003220101800000000000000000000000000000000000000000000000000000032200002202012200000222070121032101230c21020c45706f63684d616e6167657204210320221f0e01202205000107820001070a0001070a0001070a0001070a0e0120220201010a02000000000000000001070a100222000107822201010a03000000000000000e0120220201010a0400000000000000000107a00d0122000107070e0120220601010a060000000000000001010a060000000000000001010a07000000000000000001070a0001070a0001070a0d01220001070710022201010a04000000000000002201010a08000000000000000e012022030001078200010791000107820e012022000e012022010001070a0e012022010001070a0e0120220201010a040000000000000001010a0d000000000000000f012307200300220001220002220101010a0e000000000000000f012307200300220101010a0f0000000000000001220101010a1a0000000000000002220101010a1a000000000000000f012307200500220101010a100000000000000001220201010a150000000000000001010a160000000000000002220201010a170000000000000001010a180000000000000003220101010a180000000000000004220101010a18000000000000000f012307200300220101010a11000000000000000122010001078302220101010a12000000000000000e0120220200010783000107c00e0120220101010a13000000000000000d012201010a14000000000000000f01230720020022010001070a0122010001070c0f0123072002002201000107a001220101010a12000000000000000f01230720020022010001078301220101010a12000000000000000f01230720020022010001070701220101010a12000000000000000f012307200200220101010a190000000000000001220101010a12000000000000000d012201010a10000000000000000d012201010a0e000000000000000e012022020001078201010a1c000000000000000f012307200200220201010a0400000000000000000107a00122000e012022010001070a0e012022020001070a01010a020000000000000020211f022201010c1445706f63684d616e616765725375627374617465220101220001200c0507616464726573730565706f636805726f756e6410726f756e64735f7065725f65706f6368126e756d5f756e7374616b655f65706f636873022201010c1456616c696461746f725365745375627374617465220101220001200c020d76616c696461746f725f7365740565706f636802220000220000022201010c0956616c696461746f72220101220001200c02036b6579057374616b65022201010c054279746573220000022201010c1745706f63684d616e61676572437265617465496e707574220101220001200c061f6f6c796d7069615f76616c696461746f725f746f6b656e5f6164647265737311636f6d706f6e656e745f616464726573730d76616c696461746f725f7365740d696e697469616c5f65706f636810726f756e64735f7065725f65706f6368126e756d5f756e7374616b655f65706f636873022201010c05427974657322000002220000220000022201010c0d56616c696461746f72496e6974220101220001200c031976616c696461746f725f6163636f756e745f616464726573730d696e697469616c5f7374616b65157374616b655f6163636f756e745f61646472657373022201010c2045706f63684d616e6167657247657443757272656e7445706f6368496e707574220000022201010c1945706f63684d616e6167657253657445706f6368496e707574220101220001200c010565706f6368022201010c1a45706f63684d616e616765724e657874526f756e64496e707574220101220001200c0105726f756e64022201010c2045706f63684d616e6167657243726561746556616c696461746f72496e707574220101220001200c02036b6579116f776e65725f6163636573735f72756c65022201010c0a41636365737352756c652201012201012307210300022201010c08416c6c6f77416c6c22000001022201010c0744656e79416c6c22000002022201010c0950726f746563746564220000022201010c0e41636365737352756c654e6f64652201012201012307210300022201010c0950726f6f6652756c6522000001022201010c05416e794f6622000002022201010c05416c6c4f66220000022201010c0950726f6f6652756c652201012201012307210500022201010c075265717569726522000001022201010c08416d6f756e744f6622000002022201010c07436f756e744f6622000003022201010c05416c6c4f6622000004022201010c05416e794f66220000022201010c19536f66745265736f757263654f724e6f6e46756e6769626c652201012201012307210300022201010c115374617469634e6f6e46756e6769626c6522000001022201010c0e5374617469635265736f7572636522000002022201010c0744796e616d6963220000022201010c134e6f6e46756e6769626c65476c6f62616c4964220000022201010c0a536368656d615061746822000002220000220000022201010c0d536368656d61537562506174682201012201012307210200022201010c05496e64657822000001022201010c054669656c64220000022201010c0b536f6674446563696d616c2201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c0c536f66745265736f757263652201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c09536f6674436f756e742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c1d536f66745265736f757263654f724e6f6e46756e6769626c654c6973742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d69632200000222000022000002220000220000022201010c2045706f63684d616e6167657255706461746556616c696461746f72496e707574220101220001200c021176616c696461746f725f6164647265737306757064617465022201010c0f55706461746556616c696461746f722201012201012307210200022201010c08526567697374657222000001022201010c0a556e7265676973746572220000022201010c10526f756e644368616e67654576656e74220101220001200c0105726f756e64022201010c1045706f63684368616e67654576656e74220101220001200c020565706f63680a76616c696461746f727320221f00000000000000000c0121022201010921000000220101092100000000000c012102220101091a000000220101091a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020220301010a000000000000000001010a010000000000000001010a0100000000000000230c210606637265617465042200002201010a050000000000000022000107820c06637265617465106372656174655f76616c696461746f72042201012201002201010a0c0000000000000022000107820c106372656174655f76616c696461746f72116765745f63757272656e745f65706f6368042201012200002201010a0900000000000000220001070a0c116765745f63757272656e745f65706f63680a6e6578745f726f756e64042201012201002201010a0b0000000000000022000107420c0a6e6578745f726f756e64097365745f65706f6368042201012201002201010a0a0000000000000022000107420c097365745f65706f6368107570646174655f76616c696461746f72042201012201002201010a1b0000000000000022000107420c107570646174655f76616c696461746f72230c22021045706f63684368616e67654576656e7401010a1e0000000000000010526f756e644368616e67654576656e7401010a1d000000000000000956616c696461746f720421032022100e01202208000107820001078201010a010000000000000000010701000107830001078301010a020000000000000001010a02000000000000000d0122000107070d0122000107070e012022000e012022000e01202201000107910e01202201000107910e01202201000107910e0120220101010a01000000000000000e01202201000107010e012022000e012022000e01202201000107a00e01202201000107a00e01202201000107a00e0120220100010701202110022201010c1156616c696461746f725375627374617465220101220001200c08076d616e616765720761646472657373036b65790d69735f726567697374657265640b756e7374616b655f6e66740f6c69717569646974795f746f6b656e127374616b655f7872645f7661756c745f69641d70656e64696e675f7872645f77697468647261775f7661756c745f6964022201010c054279746573220000022201010c054279746573220000022201010c1656616c696461746f725265676973746572496e707574220101220001200c00022201010c1856616c696461746f72556e7265676973746572496e707574220101220001200c00022201010c1356616c696461746f725374616b65496e707574220101220001200c01057374616b65022201010c1556616c696461746f72556e7374616b65496e707574220101220001200c01096c705f746f6b656e73022201010c1656616c696461746f72436c61696d587264496e707574220101220001200c01066275636b6574022201010c1756616c696461746f725570646174654b6579496e707574220101220001200c01036b6579022201010c2856616c696461746f7255706461746541636365707444656c6567617465645374616b65496e707574220101220001200c01166163636570745f64656c6567617465645f7374616b65022201010c16526567697374657256616c696461746f724576656e74220000022201010c18556e726567697374657256616c696461746f724576656e74220000022201010c0a5374616b654576656e74220101220001200c010a7872645f7374616b6564022201010c0c556e7374616b654576656e74220101220001200c010b7374616b655f756e697473022201010c0d436c61696d5872644576656e74220101220001200c010b636c61696d65645f787264022201010c28557064617465416363657074696e675374616b6544656c65676174696f6e53746174654576656e74220101220001200c0112616363657074735f64656c65676174696f6e20221000000c012102220101092100000022010109210000000c012102220101091f000000220101091f000000000000000000000000000000000000000000000000000000000020220101010a0000000000000000230c210709636c61696d5f787264042201012201002201010a070000000000000022000107910c09636c61696d5f787264087265676973746572042201012201002201010a030000000000000022000107420c087265676973746572057374616b65042201012201002201010a050000000000000022000107910c057374616b650a756e7265676973746572042201012201002201010a040000000000000022000107420c0a756e726567697374657207756e7374616b65042201012201002201010a060000000000000022000107910c07756e7374616b651d7570646174655f6163636570745f64656c6567617465645f7374616b65042201012201002201010a090000000000000022000107420c1d7570646174655f6163636570745f64656c6567617465645f7374616b650a7570646174655f6b6579042201012201002201010a080000000000000022000107420c0a7570646174655f6b6579230c22060d436c61696d5872644576656e7401010a0e0000000000000016526567697374657256616c696461746f724576656e7401010a0a000000000000000a5374616b654576656e7401010a0c0000000000000018556e726567697374657256616c696461746f724576656e7401010a0b000000000000000c556e7374616b654576656e7401010a0d0000000000000028557064617465416363657074696e675374616b6544656c65676174696f6e53746174654576656e7401010a0f00000000000000208003010000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000002020000000000000000000000000000000000000000000000000003208000090100000003220101800000000000000000000000000000000000000000000000000000032200002202012201000222080122010009010000000322010180000000000000000000000000000000000000000000000000000003220000220201220200022209012101200701030901000000032201018000000000000000000000000000000000000000000000000000000322000022020122030002220a012102220000230c2100090100000003220101800000000000000000000000000000000000000000000000000000052200002202012200000222070121032101230c2101074163636f756e7404210320221e0e01202201000107900e0120220101010a02000000000000000f012307200300220001220002220101010a03000000000000000f012307200300220101010a040000000000000001220101010a0f0000000000000002220101010a0f000000000000000f012307200500220101010a050000000000000001220201010a0a0000000000000001010a0b0000000000000002220201010a0c0000000000000001010a0d0000000000000003220101010a0d0000000000000004220101010a0d000000000000000f012307200300220101010a06000000000000000122010001078302220101010a07000000000000000e0120220200010783000107c00e0120220101010a08000000000000000d012201010a09000000000000000f01230720020022010001070a0122010001070c0f0123072002002201000107a001220101010a07000000000000000f01230720020022010001078301220101010a07000000000000000f01230720020022010001070701220101010a07000000000000000f012307200200220101010a0e0000000000000001220101010a07000000000000000d012201010a05000000000000000d012201010a03000000000000000e012022000e01202201000107a00e01202201000107a00e01202201000107910e0120220101010a15000000000000000d0122000107910e0120220200010783000107a00e012022020001078301010a18000000000000000d0122000107c00e01202203000107a000010783000107a00e01202203000107a00001078301010a18000000000000000e01202201000107830e0120220200010783000107a00e012022020001078301010a180000000000000020211e022201010c0f4163636f756e745375627374617465220101220001200c01067661756c7473022201010c184163636f756e74437265617465476c6f62616c496e707574220101220001200c010d77697468647261775f72756c65022201010c0a41636365737352756c652201012201012307210300022201010c08416c6c6f77416c6c22000001022201010c0744656e79416c6c22000002022201010c0950726f746563746564220000022201010c0e41636365737352756c654e6f64652201012201012307210300022201010c0950726f6f6652756c6522000001022201010c05416e794f6622000002022201010c05416c6c4f66220000022201010c0950726f6f6652756c652201012201012307210500022201010c075265717569726522000001022201010c08416d6f756e744f6622000002022201010c07436f756e744f6622000003022201010c05416c6c4f6622000004022201010c05416e794f66220000022201010c19536f66745265736f757263654f724e6f6e46756e6769626c652201012201012307210300022201010c115374617469634e6f6e46756e6769626c6522000001022201010c0e5374617469635265736f7572636522000002022201010c0744796e616d6963220000022201010c134e6f6e46756e6769626c65476c6f62616c4964220000022201010c0a536368656d615061746822000002220000220000022201010c0d536368656d61537562506174682201012201012307210200022201010c05496e64657822000001022201010c054669656c64220000022201010c0b536f6674446563696d616c2201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c0c536f66745265736f757263652201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c09536f6674436f756e742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c1d536f66745265736f757263654f724e6f6e46756e6769626c654c6973742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d69632200000222000022000002220000220000022201010c174163636f756e744372656174654c6f63616c496e707574220101220001200c00022201010c134163636f756e744c6f636b466565496e707574220101220001200c0106616d6f756e74022201010c1d4163636f756e744c6f636b436f6e74696e67656e74466565496e707574220101220001200c0106616d6f756e74022201010c134163636f756e744465706f736974496e707574220101220001200c01066275636b6574022201010c184163636f756e744465706f7369744261746368496e707574220101220001200c01076275636b65747302220000220000022201010c144163636f756e745769746864726177496e707574220101220001200c02107265736f757263655f6164647265737306616d6f756e74022201010c204163636f756e7457697468647261774e6f6e46756e6769626c6573496e707574220101220001200c02107265736f757263655f616464726573730369647302220000220000022201010c1e4163636f756e744c6f636b466565416e645769746864726177496e707574220101220001200c030e616d6f756e745f746f5f6c6f636b107265736f757263655f6164647265737306616d6f756e74022201010c2a4163636f756e744c6f636b466565416e6457697468647261774e6f6e46756e6769626c6573496e707574220101220001200c030e616d6f756e745f746f5f6c6f636b107265736f757263655f6164647265737303696473022201010c174163636f756e7443726561746550726f6f66496e707574220101220001200c01107265736f757263655f61646472657373022201010c1f4163636f756e7443726561746550726f6f664279416d6f756e74496e707574220101220001200c02107265736f757263655f6164647265737306616d6f756e74022201010c1c4163636f756e7443726561746550726f6f664279496473496e707574220101220001200c02107265736f757263655f616464726573730369647320221e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020220101010a0000000000000000230c210d0d6372656174655f676c6f62616c042200002201010a010000000000000022000107820c0d6372656174655f676c6f62616c0c6372656174655f6c6f63616c042200002201010a100000000000000022000107900c0c6372656174655f6c6f63616c0c6372656174655f70726f6f66042201012200002201010a1b0000000000000022000107920c0c6372656174655f70726f6f66166372656174655f70726f6f665f62795f616d6f756e74042201012200002201010a1c0000000000000022000107920c166372656174655f70726f6f665f62795f616d6f756e74136372656174655f70726f6f665f62795f696473042201012200002201010a1d0000000000000022000107920c136372656174655f70726f6f665f62795f696473076465706f736974042201012200002201010a130000000000000022000107420c076465706f7369740d6465706f7369745f6261746368042201012200002201010a140000000000000022000107420c0d6465706f7369745f6261746368136c6f636b5f636f6e74696e67656e745f666565042201012200002201010a120000000000000022000107420c136c6f636b5f636f6e74696e67656e745f666565086c6f636b5f666565042201012200002201010a110000000000000022000107420c086c6f636b5f666565156c6f636b5f6665655f616e645f7769746864726177042201012200002201010a190000000000000022000107910c156c6f636b5f6665655f616e645f7769746864726177236c6f636b5f6665655f616e645f77697468647261775f6e6f6e5f66756e6769626c6573042201012200002201010a1a0000000000000022000107910c236c6f636b5f6665655f616e645f77697468647261775f6e6f6e5f66756e6769626c6573087769746864726177042201012200002201010a160000000000000022000107910c0877697468647261771677697468647261775f6e6f6e5f66756e6769626c6573042201012200002201010a170000000000000022000107910c1677697468647261775f6e6f6e5f66756e6769626c6573230c2200208000208000090100000003220101800000000000000000000000000000000000000000000000000000052200002202012201000222080122010009010000000322010180000000000000000000000000000000000000000000000000000005220000220201220200022209012101200701050901000000032201018000000000000000000000000000000000000000000000000000000522000022020122030002220a012102220000230c21000901000000032201018000000000000000000000000000000000000000000000000000000722000022020122030002220a012102220000230c21000901000000032201018000000000000000000000000000000000000000000000000000000722000022020122040002220b012102232122002200000901000000032201018000000000000000000000000000000000000000000000000000000a2200002202012200000222070121032101230c2101084d657461646174610421032022110e012022000e0120220101010a02000000000000001002220001070c220001070c0e012022020001070c000107400e012022010001070c0f0123072002002200012201000107400e012022010001070c0e012022020001070c01010a08000000000000000f012307200200220101010a090000000000000001220101010a0f000000000000000f012307200e0022010001070c0122010001070102220100010707032201000107090422010001070a0522010001070406220100010705072201000107a00822010001078009220101010a0a000000000000000a220101010a0d000000000000000b2201000107c00c220101010a0e000000000000000d22010001070c0f012307200200220101010a0b0000000000000001220101010a0c000000000000000d0122000107070d0122000107070e0120220200010783000107c00e01202201000107050d012201010a09000000000000000e012022010001070c202111022201010c134d65746164617461437265617465496e707574220101220001200c00022201010c1b4d657461646174614372656174655769746844617461496e707574220101220001200c01046461746102220000220000022201010c104d65746164617461536574496e707574220101220001200c02036b65790576616c7565022201010c104d65746164617461476574496e707574220101220001200c01036b6579022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c134d6574616461746152656d6f7665496e707574220101220001200c01036b6579022201010c105365744d657461646174614576656e74220101220001200c02036b65790576616c7565022201010c0d4d65746164617461456e7472792201012201012307210200022201010c0556616c756522000001022201010c044c697374220000022201010c0d4d6574616461746156616c75652201012201012307210e00022201010c06537472696e6722000001022201010c04426f6f6c22000002022201010c02553822000003022201010c0355333222000004022201010c0355363422000005022201010c0349333222000006022201010c0349363422000007022201010c07446563696d616c22000008022201010c074164647265737322000009022201010c095075626c69634b65792200000a022201010c134e6f6e46756e6769626c65476c6f62616c49642200000b022201010c124e6f6e46756e6769626c654c6f63616c49642200000c022201010c07496e7374616e742200000d022201010c0355726c220000022201010c095075626c69634b65792201012201012307210200022201010c0e4563647361536563703235366b3122000001022201010c0c456464736145643235353139220000022201010c054279746573220000022201010c054279746573220000022201010c134e6f6e46756e6769626c65476c6f62616c4964220000022201010c07496e7374616e74220101220001200c01187365636f6e64735f73696e63655f756e69785f65706f636802220000220000022201010c1352656d6f76654d657461646174614576656e74220101220001200c01036b6579202211000000000000000000000000000000000000000000000c012102220101092100000022010109210000000c012102220101092000000022010109200000000000000000000000202200230c210506637265617465042200002201010a000000000000000022000107900c06637265617465106372656174655f776974685f64617461042200002201010a010000000000000022000107900c106372656174655f776974685f6461746103676574042201012200002201010a04000000000000002201010a05000000000000000c036765740672656d6f7665042201012200002201010a060000000000000022000107010c0672656d6f766503736574042201012201002201010a030000000000000022000107420c03736574230c22021352656d6f76654d657461646174614576656e7401010a1000000000000000105365744d657461646174614576656e7401010a07000000000000002080002080000901000000032201018000000000000000000000000000000000000000000000000000000a220000220201220100022208012201000901000000032201018000000000000000000000000000000000000000000000000000000a2200002202012202000222090121012007010a0901000000032201018000000000000000000000000000000000000000000000000000000a22000022020122030002220a012102220000230c21000901000000032201018000000000000000000000000000000000000000000000000000000a22000022020122040002220b01210223212202020c084d657461646174610c066372656174650000020c084d657461646174610c106372656174655f776974685f6461746100002201000901000000032201018000000000000000000000000000000000000000000000000000000b2200002202012200000222070121032101230c210110436f6d706f6e656e74526f79616c74790421032022080e0120220101010a01000000000000000e0120220201010a0200000000000000000107091002220001070c22000107090e0120220101010a04000000000000000f0123072002002200012201000107900e0120220101010a01000000000000000e0120220101010a01000000000000000e01202200202108022201010c1e436f6d706f6e656e74526f79616c7479436f6e6669675375627374617465220101220001200c010e726f79616c74795f636f6e666967022201010c0d526f79616c7479436f6e666967220101220001200c020572756c65730c64656661756c745f72756c6502220000220000022201010c23436f6d706f6e656e74526f79616c7479416363756d756c61746f725375627374617465220101220001200c010d726f79616c74795f7661756c74022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d65220000022201010c1b436f6d706f6e656e74526f79616c7479437265617465496e707574220101220001200c010e726f79616c74795f636f6e666967022201010c1e436f6d706f6e656e74536574526f79616c7479436f6e666967496e707574220101220001200c010e726f79616c74795f636f6e666967022201010c1a436f6d706f6e656e74436c61696d526f79616c7479496e707574220101220001200c002022080000000000000000000000000000000020220201010a000000000000000001010a0300000000000000230c21030d636c61696d5f726f79616c7479042201012201002201010a070000000000000022000107910c0d636c61696d5f726f79616c747906637265617465042200002201010a050000000000000022000107900c06637265617465127365745f726f79616c74795f636f6e666967042201012201002201010a060000000000000022000107420c127365745f726f79616c74795f636f6e666967230c22002080010100000000000000000000000000000000000000000000000000002080000901000000032201018000000000000000000000000000000000000000000000000000000b220000220201220100022208012201000901000000032201018000000000000000000000000000000000000000000000000000000b2200002202012202000222090121012007010b0901000000032201018000000000000000000000000000000000000000000000000000000b22000022020122030002220a012102220000230c21000901000000032201018000000000000000000000000000000000000000000000000000000b22000022020122040002220b01210223212201020c10436f6d706f6e656e74526f79616c74790c0663726561746500002201000901000000032201018000000000000000000000000000000000000000000000000000000c2200002202012200000222070121032101230c21010b41636365737352756c657304210320221d0e0120220101010a01000000000000000e0120220601010a020000000000000001010a140000000000000001010a060000000000000001010a150000000000000001010a140000000000000001010a060000000000000010022201010a03000000000000002201010a05000000000000000e0120220201010a04000000000000000001070c0f01230720060022000122000222000322000422000522000f012307200200220101010a06000000000000000122010001070c0f012307200300220001220002220101010a07000000000000000f012307200300220101010a080000000000000001220101010a130000000000000002220101010a13000000000000000f012307200500220101010a090000000000000001220201010a0e0000000000000001010a0f0000000000000002220201010a100000000000000001010a110000000000000003220101010a110000000000000004220101010a11000000000000000f012307200300220101010a0a000000000000000122010001078302220101010a0b000000000000000e0120220200010783000107c00e0120220101010a0c000000000000000d012201010a0d000000000000000f01230720020022010001070a0122010001070c0f0123072002002201000107a001220101010a0b000000000000000f01230720020022010001078301220101010a0b000000000000000f01230720020022010001070701220101010a0b000000000000000f012307200200220101010a120000000000000001220101010a0b000000000000000d012201010a09000000000000000d012201010a07000000000000001002220001070c2201010a060000000000000010022201010a03000000000000002201010a06000000000000000e0120220101010a01000000000000000e0120220201010a030000000000000001010a05000000000000000e0120220201010a030000000000000001010a06000000000000000e012022020001070c01010a06000000000000000e012022020001070c01010a06000000000000000f012307200200220201010a030000000000000001010a05000000000000000122020001070c01010a06000000000000000f012307200200220201010a030000000000000001010a06000000000000000122020001070c01010a060000000000000020211d022201010c194d6574686f6441636365737352756c65735375627374617465220101220001200c010c6163636573735f72756c6573022201010c1141636365737352756c6573436f6e666967220101220001200c060b6d6574686f645f617574680c67726f757065645f617574680c64656661756c745f61757468166d6574686f645f617574685f6d75746162696c6974791767726f757065645f617574685f6d75746162696c6974791764656661756c745f617574685f6d75746162696c69747902220000220000022201010c094d6574686f644b6579220101220001200c020e6e6f64655f6d6f64756c655f6964056964656e74022201010c0c4e6f64654d6f64756c6549642201012201012307210600022201010c0453454c4622000001022201010c0854797065496e666f22000002022201010c084d6574616461746122000003022201010c0b41636365737352756c657322000004022201010c0c41636365737352756c65733122000005022201010c10436f6d706f6e656e74526f79616c7479220000022201010c0f41636365737352756c65456e7472792201012201012307210200022201010c0a41636365737352756c6522000001022201010c0547726f7570220000022201010c0a41636365737352756c652201012201012307210300022201010c08416c6c6f77416c6c22000001022201010c0744656e79416c6c22000002022201010c0950726f746563746564220000022201010c0e41636365737352756c654e6f64652201012201012307210300022201010c0950726f6f6652756c6522000001022201010c05416e794f6622000002022201010c05416c6c4f66220000022201010c0950726f6f6652756c652201012201012307210500022201010c075265717569726522000001022201010c08416d6f756e744f6622000002022201010c07436f756e744f6622000003022201010c05416c6c4f6622000004022201010c05416e794f66220000022201010c19536f66745265736f757263654f724e6f6e46756e6769626c652201012201012307210300022201010c115374617469634e6f6e46756e6769626c6522000001022201010c0e5374617469635265736f7572636522000002022201010c0744796e616d6963220000022201010c134e6f6e46756e6769626c65476c6f62616c4964220000022201010c0a536368656d615061746822000002220000220000022201010c0d536368656d61537562506174682201012201012307210200022201010c05496e64657822000001022201010c054669656c64220000022201010c0b536f6674446563696d616c2201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c0c536f66745265736f757263652201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c09536f6674436f756e742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d6963220000022201010c1d536f66745265736f757263654f724e6f6e46756e6769626c654c6973742201012201012307210200022201010c0653746174696322000001022201010c0744796e616d696322000002220000220000022200002200000222000022000002220000220000022201010c1641636365737352756c6573437265617465496e707574220101220001200c010c6163636573735f72756c6573022201010c2341636365737352756c65735365744d6574686f6441636365737352756c65496e707574220101220001200c02036b65790472756c65022201010c2341636365737352756c65735365744d6574686f644d75746162696c697479496e707574220101220001200c02036b65790a6d75746162696c697479022201010c2241636365737352756c657353657447726f757041636365737352756c65496e707574220101220001200c02046e616d650472756c65022201010c2241636365737352756c657353657447726f75704d75746162696c697479496e707574220101220001200c02046e616d650a6d75746162696c697479022201010c0c53657452756c654576656e742201012201012307210200022201010c064d6574686f64220101220001200c02036b65790472756c6501022201010c0547726f7570220101220001200c02046e616d650472756c65022201010c125365744d75746162696c6974794576656e742201012201012307210200022201010c064d6574686f64220101220001200c02036b65790a6d75746162696c69747901022201010c0547726f7570220101220001200c02046e616d650a6d75746162696c69747920221d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020220101010a0000000000000000230c210506637265617465042200002201010a160000000000000022000107900c06637265617465157365745f67726f75705f6163636573735f72756c65042201012201002201010a190000000000000022000107420c157365745f67726f75705f6163636573735f72756c65147365745f67726f75705f6d75746162696c697479042201012201002201010a1a0000000000000022000107420c147365745f67726f75705f6d75746162696c697479167365745f6d6574686f645f6163636573735f72756c65042201012201002201010a170000000000000022000107420c167365745f6d6574686f645f6163636573735f72756c65157365745f6d6574686f645f6d75746162696c697479042201012201002201010a180000000000000022000107420c157365745f6d6574686f645f6d75746162696c697479230c2202125365744d75746162696c6974794576656e7401010a1c000000000000000c53657452756c654576656e7401010a1b000000000000002080002080000901000000032201018000000000000000000000000000000000000000000000000000000c220000220201220100022208012201000901000000032201018000000000000000000000000000000000000000000000000000000c2200002202012202000222090121012007010c0901000000032201018000000000000000000000000000000000000000000000000000000c22000022020122030002220a012102220000230c21000901000000032201018000000000000000000000000000000000000000000000000000000c22000022020122040002220b01210223212201020c0b41636365737352756c65730c06637265617465000022010009010000000322010180050000000000000000000000000000000000000000000000000000220000220601220000022200012105800500000000000000000000000000000000000000000000000000000a7d060000000000000a00000000000000000a08070000000000000a010000000000000009c2972d000322010180050000000000000000000000000000000000000000000000000000220100220e0122000002221301220003800000000000000000000000000000000000000000000000000000030c0c45706f63684d616e61676572010109010000000322010180050000000000000000000000000000000000000000000000000000220300220f01220000022214012101210623212206022200000c106372656174655f76616c696461746f720001220000022200000c116765745f63757272656e745f65706f63680001220000022200000c0a6e6578745f726f756e640001220201220001220001220001210280020000000000000000000000000000000000000000000000000002c0010000000000000001022200000c097365745f65706f63680001220201220001220001220001210280020000000000000000000000000000000000000000000000000002c0010000000000000000022200000c107570646174655f76616c696461746f720001220201220001220001220001210280020000000000000000000000000000000000000000000000000003c0021d5c80000000000000000000000000000000000000000000000000000003022202000c036765740001220000230c220022010023212201022202000c036765740100230c2200220100090100000003220101800500000000000000000000000000000000000000000000000000002205002210012200000222150121012102230c0900090000000009010000000322010180062dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf2200002207012200000222020121088005000000000000000000000000000000000000000000000000000080062dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf20072103c30ac032d7d808e6bfe571dcf4c6b048c0e389d3dbf0d72787e738c7fbf042d7010080022dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf80012dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf20071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0100000020071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0200000009000000000322010180062dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf220100220e0122000002221301220003800000000000000000000000000000000000000000000000000000030c0956616c696461746f72010109000000000322010180062dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf220300220f01220000022214012101210623212209022200000c09636c61696d5f7872640001220000022200000c08726567697374657201010c056f776e6572022200000c057374616b6501010c056f776e6572022200000c0a756e726567697374657201010c056f776e6572022200000c07756e7374616b650001220000022200000c1d7570646174655f6163636570745f64656c6567617465645f7374616b6501010c056f776e6572022200000c0a7570646174655f6b657901010c056f776e6572022202000c036765740001220000022202000c0373657401010c056f776e6572230c2201056f776e657202012200012200012201018002ce74f3dde7392cc536a90e51dfe2f16239e5350be674d3c5a5ec22010023212202022200000c057374616b650201220001220001220001210280020000000000000000000000000000000000000000000000000003c0021d5c80000000000000000000000000000000000000000000000000000003022202000c036765740100230c2201056f776e6572010022010009000000000322010180062dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf2205002210012200000222150121012102230c0900090000000009000000000322010180062dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf2205002210012201000222160121012200000900000000032201018009601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b862220000220c0122000002220c01210190040fbfa1fbf057e0f8f3844f2c6374c4f0a295893e56d041b580d753020000000901000000032201018009601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b862220100220e0122000002221301220003800000000000000000000000000000000000000000000000000000050c074163636f756e7401010901000000032201018009601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b862220300220f01220000022214012101210623212203022200000c076465706f7369740001220000022200000c0d6465706f7369745f62617463680001220000022202000c036765740001220000230c2200220201220001220001220001210280020000000000000000000000000000000000000000000000000001c0021a601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b86223212203022200000c076465706f7369740100022200000c0d6465706f7369745f62617463680100022202000c036765740100230c2200220201220001220001220001210280020000000000000000000000000000000000000000000000000001c0021a601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b8620901000000032201018009601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b8622205002210012200000222150121012102230c0900090000000009010000000322010180010000000000000000000000000000000000000000000000000000220000220301220000022204012103800100000000000000000000000000000000000000000000000000000712a000000040eaed7446d09c2c9f0c0000000000000000000000000000000000000009010000000322010180010000000000000000000000000000000000000000000000000000220100220e0122000002221301220003800000000000000000000000000000000000000000000000000000010c1746756e6769626c655265736f757263654d616e61676572010109010000000322010180010000000000000000000000000000000000000000000000000000220300220f0122000002221401210121062321220c022200000c046275726e0001220100022200000c0d6372656174655f6275636b65740001220000022200000c0c6372656174655f7661756c740001220000022200000c106765745f6e6f6e5f66756e6769626c650001220000022200000c116765745f7265736f757263655f747970650001220000022200000c106765745f746f74616c5f737570706c790001220000022200000c046d696e7401010c046d696e74022200000c096d696e745f7575696401010c046d696e74022200000c136e6f6e5f66756e6769626c655f6578697374730001220000022200000c187570646174655f6e6f6e5f66756e6769626c655f646174610001220000022202000c036765740001220000022202000c037365740001220100230c2201046d696e7401002201002321220c022200000c046275726e0100022200000c0d6372656174655f6275636b65740100022200000c0c6372656174655f7661756c740100022200000c106765745f6e6f6e5f66756e6769626c650100022200000c116765745f7265736f757263655f747970650100022200000c106765745f746f74616c5f737570706c790100022200000c046d696e740100022200000c096d696e745f757569640100022200000c136e6f6e5f66756e6769626c655f6578697374730100022200000c187570646174655f6e6f6e5f66756e6769626c655f646174610100022202000c036765740100022202000c037365740100230c2201046d696e74010022010009010000000322010180012dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf22000022030122000002220401210380012dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf0712a0000000000000000000000000000000000000000000000000000000000000000009000000000322010180012dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf220100220e0122000002221301220003800000000000000000000000000000000000000000000000000000010c1746756e6769626c655265736f757263654d616e61676572010109000000000322010180012dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf220300220f0122000002221401210121062321220c022200000c046275726e0001220201220001220001220001210280020000000000000000000000000000000000000000000000000003c0021d5c80000000000000000000000000000000000000000000000000000003022200000c0d6372656174655f6275636b65740001220000022200000c0c6372656174655f7661756c740001220000022200000c106765745f6e6f6e5f66756e6769626c650001220000022200000c116765745f7265736f757263655f747970650001220000022200000c106765745f746f74616c5f737570706c790001220000022200000c046d696e7401010c046d696e74022200000c096d696e745f7575696401010c046d696e74022200000c136e6f6e5f66756e6769626c655f6578697374730001220000022200000c187570646174655f6e6f6e5f66756e6769626c655f646174610001220000022202000c036765740001220000022202000c037365740001220100230c2201046d696e740201220001220001220001210280020000000000000000000000000000000000000000000000000003c0021d5c800000000000000000000000000000000000000000000000000000032201002321220c022200000c046275726e0100022200000c0d6372656174655f6275636b65740100022200000c0c6372656174655f7661756c740100022200000c106765745f6e6f6e5f66756e6769626c650100022200000c116765745f7265736f757263655f747970650100022200000c106765745f746f74616c5f737570706c790100022200000c046d696e740100022200000c096d696e745f757569640100022200000c136e6f6e5f66756e6769626c655f6578697374730100022200000c187570646174655f6e6f6e5f66756e6769626c655f646174610100022202000c036765740100022202000c037365740100230c2201046d696e74010022010009000000000322010180012dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf220400220f0122000002221401210121062321220f022200000c115661756c745f6c6f636b5f616d6f756e740001220000022200000c185661756c745f6c6f636b5f6e6f6e5f66756e6769626c65730001220000022200000c135661756c745f756e6c6f636b5f616d6f756e740001220000022200000c1a5661756c745f756e6c6f636b5f6e6f6e5f66756e6769626c65730001220000022200000c0c6372656174655f70726f6f660001220000022200000c166372656174655f70726f6f665f62795f616d6f756e740001220000022200000c136372656174655f70726f6f665f62795f6964730001220000022200000c0a6765745f616d6f756e740001220000022200000c1a6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f6964730001220000022200000c146765745f7265736f757263655f616464726573730001220000022200000c086c6f636b5f66656501010c087769746864726177022200000c037075740001220000022200000c0474616b6501010c087769746864726177022200000c1274616b655f6e6f6e5f66756e6769626c657301010c087769746864726177022202000c036765740001220000230c220206726563616c6c010008776974686472617700002201002321220f022200000c115661756c745f6c6f636b5f616d6f756e740100022200000c185661756c745f6c6f636b5f6e6f6e5f66756e6769626c65730100022200000c135661756c745f756e6c6f636b5f616d6f756e740100022200000c1a5661756c745f756e6c6f636b5f6e6f6e5f66756e6769626c65730100022200000c0c6372656174655f70726f6f660100022200000c166372656174655f70726f6f665f62795f616d6f756e740100022200000c136372656174655f70726f6f665f62795f6964730100022200000c0a6765745f616d6f756e740100022200000c1a6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f6964730100022200000c146765745f7265736f757263655f616464726573730100022200000c086c6f636b5f6665650100022200000c037075740100022200000c0474616b650100022200000c1274616b655f6e6f6e5f66756e6769626c65730100022202000c036765740100230c220206726563616c6c0100087769746864726177010022010009000000000322010180012dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf2205002210012200000222150121012102230c0900090000000009000000000322010180012dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf22050022100122010002221601210122000009000000000322010180022dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf22000022030122000002220501210680022dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bfa000000000000000000000000000000000000000000000000000000000000000002203002201010a000000000000000020071f0f9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe03000000200c0009000000000322010180022dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf220100220e0122000002221301220003800000000000000000000000000000000000000000000000000000010c1a4e6f6e46756e6769626c655265736f757263654d616e61676572010109000000000322010180022dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf220300220f0122000002221401210121062321220c022200000c046275726e0001220201220001220001220001210280020000000000000000000000000000000000000000000000000003c0021d5c80000000000000000000000000000000000000000000000000000003022200000c0d6372656174655f6275636b65740001220000022200000c0c6372656174655f7661756c740001220000022200000c106765745f6e6f6e5f66756e6769626c650001220000022200000c116765745f7265736f757263655f747970650001220000022200000c106765745f746f74616c5f737570706c790001220000022200000c046d696e7401010c046d696e74022200000c096d696e745f7575696401010c046d696e74022200000c136e6f6e5f66756e6769626c655f6578697374730001220000022200000c187570646174655f6e6f6e5f66756e6769626c655f646174610001220000022202000c036765740001220000022202000c037365740001220100230c2201046d696e740201220001220001220001210280020000000000000000000000000000000000000000000000000003c0021d5c800000000000000000000000000000000000000000000000000000032201002321220c022200000c046275726e0100022200000c0d6372656174655f6275636b65740100022200000c0c6372656174655f7661756c740100022200000c106765745f6e6f6e5f66756e6769626c650100022200000c116765745f7265736f757263655f747970650100022200000c106765745f746f74616c5f737570706c790100022200000c046d696e740100022200000c096d696e745f757569640100022200000c136e6f6e5f66756e6769626c655f6578697374730100022200000c187570646174655f6e6f6e5f66756e6769626c655f646174610100022202000c036765740100022202000c037365740100230c2201046d696e74010022010009000000000322010180022dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf220400220f0122000002221401210121062321220f022200000c115661756c745f6c6f636b5f616d6f756e740001220000022200000c185661756c745f6c6f636b5f6e6f6e5f66756e6769626c65730001220000022200000c135661756c745f756e6c6f636b5f616d6f756e740001220000022200000c1a5661756c745f756e6c6f636b5f6e6f6e5f66756e6769626c65730001220000022200000c0c6372656174655f70726f6f660001220000022200000c166372656174655f70726f6f665f62795f616d6f756e740001220000022200000c136372656174655f70726f6f665f62795f6964730001220000022200000c0a6765745f616d6f756e740001220000022200000c1a6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f6964730001220000022200000c146765745f7265736f757263655f616464726573730001220000022200000c086c6f636b5f66656501010c087769746864726177022200000c037075740001220000022200000c0474616b6501010c087769746864726177022200000c1274616b655f6e6f6e5f66756e6769626c657301010c087769746864726177022202000c036765740001220000230c220206726563616c6c010008776974686472617700002201002321220f022200000c115661756c745f6c6f636b5f616d6f756e740100022200000c185661756c745f6c6f636b5f6e6f6e5f66756e6769626c65730100022200000c135661756c745f756e6c6f636b5f616d6f756e740100022200000c1a5661756c745f756e6c6f636b5f6e6f6e5f66756e6769626c65730100022200000c0c6372656174655f70726f6f660100022200000c166372656174655f70726f6f665f62795f616d6f756e740100022200000c136372656174655f70726f6f665f62795f6964730100022200000c0a6765745f616d6f756e740100022200000c1a6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f6964730100022200000c146765745f7265736f757263655f616464726573730100022200000c086c6f636b5f6665650100022200000c037075740100022200000c0474616b650100022200000c1274616b655f6e6f6e5f66756e6769626c65730100022202000c036765740100230c220206726563616c6c0100087769746864726177010022010009000000000322010180022dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf2205002210012200000222150121012102230c0900090000000009000000000322010180022dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf2205002210012201000222160121012200000900000000032201018002ce74f3dde7392cc536a90e51dfe2f16239e5350be674d3c5a5ec220100220e0122000002221301220003800000000000000000000000000000000000000000000000000000010c1a4e6f6e46756e6769626c655265736f757263654d616e61676572010109010000000322020120071f0f9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe03000000220100220e0122000002221301220101210421032022020e012022020001070a000107a00f012307200200220001220101010a0000000000000000202102022201010c0b556e7374616b6544617461220101220001200c020e65706f63685f756e6c6f636b656406616d6f756e74022201010c064f7074696f6e2201012201012307210200022201010c044e6f6e6522000001022201010c04536f6d652200002022020000000022000107c02201010a0100000000000000010009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0100000022000022050122000002220e01210280010000000000000000000000000000000000000000000000000000220001071209000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0100000022000022050122010002220f012101a0000000000000000000000000000000000000000000000000000000000000000009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0100000022000022050122020002221101210123a00a0009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0100000022000022050122030002221001210120c00009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0100000022000022050122040002221201210123c00a0009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe01000000220100220e0122000002221301220003800000000000000000000000000000000000000000000000000000010c055661756c74010009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0200000022000022050122000002220e01210280010000000000000000000000000000000000000000000000000000220001071209000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0200000022000022050122010002220f012101a0000000000000000000000000000000000000000000000000000000000000000009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0200000022000022050122020002221101210123a00a0009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0200000022000022050122030002221001210120c00009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe0200000022000022050122040002221201210123c00a0009000000000322030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe02000000220100220e0122000002221301220003800000000000000000000000000000000000000000000000000000010c055661756c740100090000000020212a03210322010180000000000000000000000000000000000000000000000000000001220000220201220000200720d800e1ccc9bb345551391ec3225a98de672ddf3cfb88c97e7a51462c26b29a1409000000000321032201018000000000000000000000000000000000000000000000000000000122000022020122010020072097081a2b4b75fdc7043f5680fde4f55aa4c5f7816b7f886998bda74007b4206d090000000003210322010180000000000000000000000000000000000000000000000000000001220000220201220200200720dbf1fa306ff421291733760715a0aeb51ae4216659502f0a378e3dd11e63ce09090000000003210322010180000000000000000000000000000000000000000000000000000001220000220201220300200720e1bb28377e1c960171d9b27cac5d63299ddc74ac2e852e2133cee172f65e7235090000000003210322010180000000000000000000000000000000000000000000000000000001220000220201220400200720a60c96105ea12b2c7bbda114b27fed35543a93a431a6abe39cf5f5b338fe0db6090000000003210322010180000000000000000000000000000000000000000000000000000003220000220201220000200720730197556af0f1147409bcdcedb98fe6cce56bf0a3208c36813d82032b6d874409000000000321032201018000000000000000000000000000000000000000000000000000000322000022020122010020072097081a2b4b75fdc7043f5680fde4f55aa4c5f7816b7f886998bda74007b4206d0900000000032103220101800000000000000000000000000000000000000000000000000000032200002202012202002007204c3ab23069e7ca28d38a5078b531f27d1184a021ff29b417226188777c6c1c8a090000000003210322010180000000000000000000000000000000000000000000000000000003220000220201220300200720e1bb28377e1c960171d9b27cac5d63299ddc74ac2e852e2133cee172f65e723509000000000321032201018000000000000000000000000000000000000000000000000000000522000022020122000020072061e0f7aff23a28adbfa68dccb151d4477afe6de73580a10c66aca903515c295409000000000321032201018000000000000000000000000000000000000000000000000000000522000022020122010020072097081a2b4b75fdc7043f5680fde4f55aa4c5f7816b7f886998bda74007b4206d090000000003210322010180000000000000000000000000000000000000000000000000000005220000220201220200200720df63a282c08a670a488ce330c1d992fb7ea71538c4e08138115e2517fd2d01dd090000000003210322010180000000000000000000000000000000000000000000000000000005220000220201220300200720e1bb28377e1c960171d9b27cac5d63299ddc74ac2e852e2133cee172f65e7235090000000003210322010180000000000000000000000000000000000000000000000000000007220000220201220300200720e1bb28377e1c960171d9b27cac5d63299ddc74ac2e852e2133cee172f65e7235090000000003210322010180000000000000000000000000000000000000000000000000000007220000220201220400200720a60c96105ea12b2c7bbda114b27fed35543a93a431a6abe39cf5f5b338fe0db609000000000321032201018000000000000000000000000000000000000000000000000000000a220000220201220000200720e92e69a89129fa4bbb84d65528a8cc0c7bd09679a374782c8b124e592ea0f1b909000000000321032201018000000000000000000000000000000000000000000000000000000a22000022020122010020072097081a2b4b75fdc7043f5680fde4f55aa4c5f7816b7f886998bda74007b4206d09000000000321032201018000000000000000000000000000000000000000000000000000000a22000022020122020020072070a1d5472770477d100787e4363def728fbbe63357008a13ebab4fa2839d5df309000000000321032201018000000000000000000000000000000000000000000000000000000a220000220201220300200720e1bb28377e1c960171d9b27cac5d63299ddc74ac2e852e2133cee172f65e723509000000000321032201018000000000000000000000000000000000000000000000000000000a22000022020122040020072010838ee24f5c7d9f5a1e81fb20002e90052bb8423551fac4ceacdb4beb83d69c09000000000321032201018000000000000000000000000000000000000000000000000000000b220000220201220000200720a777f56913aa10c47556ced4c538061546f90a7f5f880bcc24685e47b036831009000000000321032201018000000000000000000000000000000000000000000000000000000b22000022020122010020072097081a2b4b75fdc7043f5680fde4f55aa4c5f7816b7f886998bda74007b4206d09000000000321032201018000000000000000000000000000000000000000000000000000000b22000022020122020020072012042052ded3b7f61c975bf6e503d461ddf26b2cfd290d3ad900fd7632bbf7e709000000000321032201018000000000000000000000000000000000000000000000000000000b220000220201220300200720e1bb28377e1c960171d9b27cac5d63299ddc74ac2e852e2133cee172f65e723509000000000321032201018000000000000000000000000000000000000000000000000000000b220000220201220400200720ecd4ce68ca490d337d1e092bc35da59369f7f6b06f8b60eef275146ad1dd7ffa09000000000321032201018000000000000000000000000000000000000000000000000000000c2200002202012200002007203850771e0309a61b401f75ac16d6dd48b11f9bf7d1bec320237dd9f42daba18409000000000321032201018000000000000000000000000000000000000000000000000000000c22000022020122010020072097081a2b4b75fdc7043f5680fde4f55aa4c5f7816b7f886998bda74007b4206d09000000000321032201018000000000000000000000000000000000000000000000000000000c220000220201220200200720a7a14c590a6eefed247bd80d2c80adc70659ecdee3b81429d84f3d3ff9babd0809000000000321032201018000000000000000000000000000000000000000000000000000000c220000220201220300200720e1bb28377e1c960171d9b27cac5d63299ddc74ac2e852e2133cee172f65e723509000000000321032201018000000000000000000000000000000000000000000000000000000c22000022020122040020072086de4753886f310f2f8ee640e46c5eeaad5b2800bd3ef6d849ac0ae743b34d1b090000000003210322010180050000000000000000000000000000000000000000000000000000220000220601220000200720ddd30ddca83cc78deac919d0ace35a74c9f6fc5beb08e69663a90d110838f76709c1972d0003210322010180050000000000000000000000000000000000000000000000000000220100220e012200002007202f5722a0565f1f12c34ec8597d5d45a0243f02ea7b1f4a32b865040912cd9697090000000003210322010180050000000000000000000000000000000000000000000000000000220300220f01220000200720d7f6096f4d966c0a1de1f933bb89ce0185bab15dabd0c260e74af5e5ca3e32f7090000000003210322010180050000000000000000000000000000000000000000000000000000220500221001220000200720000ad3f029db0ab267bc5183a78f8275707b5f9442f25c1459a63f75a5e396b309000000000321032201018009601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b862220000220c01220000200720a870d4e7f4ecac0cee189c12d8b358976b654976b9d42a88d358cdacdca4de5209000000000321032201018009601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b862220100220e01220000200720d8a282649d230ee91bb20ccbca3a215c35998ec023e5c7cfae2cf259d314a0aa09000000000321032201018009601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b862220300220f01220000200720906d2aad894ac854085f18a7a2c63354bec8d54a7df8a8ad6d0da18b9e49740309000000000321032201018009601d1749a05ddad7483c54cccaa74fd8ae4be464a06bd809b862220500221001220000200720000ad3f029db0ab267bc5183a78f8275707b5f9442f25c1459a63f75a5e396b30900000000032103220101800100000000000000000000000000000000000000000000000000002200002203012200002007206088a30308b8a9ef5973e8fe99985bbda858ad687972fd97944543a58121da9b090000000003210322010180010000000000000000000000000000000000000000000000000000220100220e0122000020072062e7453721aa289af32d485b7eaa4c5116edd676197be3968b169142a4b43e87090000000003210322010180010000000000000000000000000000000000000000000000000000220300220f0122000020072085da0ac4b629a61372208697b888617b113a4a768a28cf6eb4ca6a5d524e779809000000000321032201018002ce74f3dde7392cc536a90e51dfe2f16239e5350be674d3c5a5ec220100220e012200002007200ae67f7b86be2cfbc81157f4c86a2adf8a6c27b9dc9d18073cefdf347423d03609000000002105208000208001062dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf208002022dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf012dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf2380230023202300220001202202000120071d5c80062dbfa4e4f085fc3cba4bbb117fea1f22ea816e6fb1e2873625bf00012007035c2100210aa000000000000000000000000000000000000000000000000000000000000000000800000900e1f505a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000002021002322090a000050c30000030036e200000400409c00000500d8d600000600f4f501000700786301000800786900000900d8d001000b00fcca01000c008813000009de8a0a00232221002320a000202102022102220102220101800100000000000000000000000000000000000000000000000000002200002201010a20000000000000002007285c210122030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe01000000022102220102220101800100000000000000000000000000000000000000000000000000002200002201010a20000000000000002007285c210122030120071f0e9eefca119335a3052c8e514f7cb9a1309b91ae90471112086cbe020000002021002103202100230a200021030a00000000000000000a00000000000000000a0000000000000000"; - - let request = AnalyzeManifestWithPreviewContextRequest { - manifest: TransactionManifest { - instructions: InstructionList::String(manifest.to_owned()), - blobs: vec![], - }, - network_id: 0x0c, - transaction_receipt: hex::decode(receipt).unwrap(), - }; - let response = AnalyzeManifestWithPreviewContextHandler::fulfill(request).unwrap(); - println!("{response:?}") -} diff --git a/radix-engine-toolkit/tests/common_manifests.rs b/radix-engine-toolkit/tests/common_manifests.rs deleted file mode 100644 index 696ac480..00000000 --- a/radix-engine-toolkit/tests/common_manifests.rs +++ /dev/null @@ -1,165 +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 std::path::{Path, PathBuf}; - -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"; - -#[test] -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) - .map(manifest_replace) - .unwrap(); - - let manifest = TransactionManifest { - instructions: InstructionList::String(manifest_str), - blobs: vec![[10].into(), [10].into()], - }; - - let request = ConvertManifestRequest { - manifest, - instructions_output_kind: InstructionKind::Parsed, - network_id: 0xf2, - }; - - // Act - let response = ConvertManifestHandler::fulfill(request); - - // Assert - assert!(matches!(response, Ok(..))); - } -} - -#[test] -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) - .map(manifest_replace) - .unwrap(); - - let manifest = TransactionManifest { - instructions: InstructionList::String(manifest_str), - blobs: vec![[10].into()], - }; - - let request = ConvertManifestRequest { - manifest, - instructions_output_kind: InstructionKind::Parsed, - network_id: 0xf2, - }; - let response = ConvertManifestHandler::fulfill(request).unwrap(); - - let request = ConvertManifestRequest { - manifest: response.manifest, - instructions_output_kind: InstructionKind::String, - network_id: 0xf2, - }; - - // Act - let response = ConvertManifestHandler::fulfill(request); - - // Assert - assert!(matches!(response, Ok(..))); - } -} - -fn manifest_replace(string: String) -> String { - string - .replace("${", "{") - .replace( - "{xrd_resource_address}", - "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", - ) - .replace( - "{faucet_component_address}", - "component_sim1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0tshjs68x", - ) - .replace( - "{this_account_component_address}", - "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", - ) - .replace( - "{account_component_address}", - "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", - ) - .replace( - "{other_account_component_address}", - "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", - ) - .replace( - "{account_a_component_address}", - "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", - ) - .replace( - "{account_b_component_address}", - "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", - ) - .replace( - "{account_c_component_address}", - "account_sim1qspjlnwx4gdcazhral74rjgzgysrslf8ngrfmprecrrss3p9md", - ) - .replace( - "{owner_badge_resource_address}", - "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", - ) - .replace( - "{minter_badge_resource_address}", - "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", - ) - .replace( - "{auth_badge_resource_address}", - "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", - ) - .replace( - "{mintable_resource_address}", - "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k", - ) - .replace("{owner_badge_non_fungible_local_id}", "#1#") - .replace("{auth_badge_non_fungible_local_id}", "#1#") - .replace( - "{code_blob_hash}", - "5b4b01a4a3892ea3751793da57f072ae08eec694ddcda872239fc8239e4bcd1b", - ) - .replace( - "{schema_blob_hash}", - "5b4b01a4a3892ea3751793da57f072ae08eec694ddcda872239fc8239e4bcd1b", - ) - .replace("{initial_supply}", "12") - .replace("{mint_amount}", "12") - .replace("{non_fungible_local_id}", "#1#") -} - -fn rtm_file_paths>(path: P) -> Vec { - let mut paths = Vec::new(); - for entry in std::fs::read_dir(path.as_ref()).unwrap() { - let entry = entry.unwrap(); - if entry.metadata().unwrap().is_dir() { - paths.extend(rtm_file_paths(entry.path())) - } else if entry.file_name().to_str().unwrap().ends_with(".rtm") { - paths.push(entry.path()) - } - } - paths -} diff --git a/radix-engine-toolkit/tests/decompilation_tests.rs b/radix-engine-toolkit/tests/decompilation_tests.rs deleted file mode 100644 index 9f178a6e..00000000 --- a/radix-engine-toolkit/tests/decompilation_tests.rs +++ /dev/null @@ -1,201 +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 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 deleted file mode 100644 index 4e456918..00000000 --- a/radix-engine-toolkit/tests/derive_babylon_address_from_olympia_address.rs +++ /dev/null @@ -1,53 +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 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/instructions.rs b/radix-engine-toolkit/tests/instructions.rs new file mode 100644 index 00000000..34f3c539 --- /dev/null +++ b/radix-engine-toolkit/tests/instructions.rs @@ -0,0 +1,112 @@ +// 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)] +#![allow(clippy::expect_fun_call)] + +use radix_engine_common::prelude::*; +use radix_engine_toolkit::models::transaction::instruction::*; +use transaction::manifest::*; +use walkdir::WalkDir; + +#[test] +fn common_manifests_can_all_be_converted_to_serializable() { + // Arrange + let path = "."; + for entry in WalkDir::new(path) { + let path = entry.unwrap().path().canonicalize().unwrap(); + + if path.extension().and_then(|str| str.to_str()) != Some("rtm") { + continue; + } + + let manifest_string = std::fs::read_to_string(&path).unwrap(); + let manifest = compile( + &manifest_string, + &NetworkDefinition::simulator(), + MockBlobProvider::new(), + ) + .unwrap(); + + // Act + let serializable_instructions = to_serializable_instructions(&manifest.instructions, 0xf2); + + // Assert + serializable_instructions.expect(&format!("Failed on: {:?}", path)); + } +} + +#[test] +fn common_manifests_can_be_converted_to_serialized_and_back() { + // Arrange + let path = "."; + for entry in WalkDir::new(path) { + let path = entry.unwrap().path().canonicalize().unwrap(); + + if path.extension().and_then(|str| str.to_str()) != Some("rtm") { + continue; + } + + let manifest_string = std::fs::read_to_string(&path).unwrap(); + let manifest = compile( + &manifest_string, + &NetworkDefinition::simulator(), + MockBlobProvider::new(), + ) + .unwrap(); + + let serializable_instructions = + to_serializable_instructions(&manifest.instructions, 0xf2).unwrap(); + + // Act + let instructions = to_native_instructions(&serializable_instructions); + + // Assert + instructions.expect(&format!("Failed on: {:?}", path)); + } +} + +#[test] +#[ignore = "This test fails because of the issues with the IndexMap. Will fix this in the Scrypto repo."] +fn common_manifests_can_be_converted_to_serialized_and_back_and_are_equal() { + // Arrange + let path = "."; + for entry in WalkDir::new(path) { + let path = entry.unwrap().path().canonicalize().unwrap(); + + if path.extension().and_then(|str| str.to_str()) != Some("rtm") { + continue; + } + + let manifest_string = std::fs::read_to_string(&path).unwrap(); + let manifest = compile( + &manifest_string, + &NetworkDefinition::simulator(), + MockBlobProvider::new(), + ) + .unwrap(); + + let serializable_instructions = + to_serializable_instructions(&manifest.instructions, 0xf2).unwrap(); + + // Act + let instructions = to_native_instructions(&serializable_instructions).unwrap(); + + // Assert + assert_eq!(instructions, manifest.instructions, "{path:?}") + } +} diff --git a/radix-engine-toolkit/tests/manifests/access_controller/new.rtm b/radix-engine-toolkit/tests/manifests/access_controller/new.rtm new file mode 100644 index 00000000..0c6e446f --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/access_controller/new.rtm @@ -0,0 +1,12 @@ +TAKE_ALL_FROM_WORKTOP + Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") + Bucket("some_xrd"); + +CREATE_ACCESS_CONTROLLER + Bucket("some_xrd") + Tuple( + Enum(), + Enum(), + Enum() + ) + None; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/access_rule/access_rule.rtm b/radix-engine-toolkit/tests/manifests/access_rule/access_rule.rtm new file mode 100644 index 00000000..07401614 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/access_rule/access_rule.rtm @@ -0,0 +1,12 @@ +SET_OWNER_ROLE + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Enum<0u8>(); # The rule associated with the role + +LOCK_OWNER_ROLE + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez"); + +SET_ROLE + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Enum<0u8>() + "hello" # The name of the role to update the access rule for. + Enum<0u8>(); # The rule associated with the role \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/account/deposit_modes.rtm b/radix-engine-toolkit/tests/manifests/account/deposit_modes.rtm new file mode 100644 index 00000000..3526e355 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/account/deposit_modes.rtm @@ -0,0 +1,52 @@ +# This transaction manifest file shows how an account could be configured to use any of the four +# allowed deposit modes. This manifest shows it for all four; thus, you're likely only going to need +# a subset of this full manifest. + +# ================================================================================================== +# 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. +# ================================================================================================== +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# Example 1: Allow All deposits mode +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "change_account_default_deposit_rule" + Enum(); + +# Example 2: Deny All deposits mode +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "change_account_default_deposit_rule" + Enum(); + +# Example 3: Allow existing deposits mode +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "change_account_default_deposit_rule" + Enum(); + +# Example 4a: Adding a resource to the allow list +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "configure_resource_deposit_rule" + Address("resource_sim1thcgx0f3rwaeetl67cmsssv4p748kd3sjhtge9l4m6ns7cucs97tjv") + Enum(); + +# Example 4a: Adding a resource to the deny list +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "configure_resource_deposit_rule" + Address("resource_sim1thcgx0f3rwaeetl67cmsssv4p748kd3sjhtge9l4m6ns7cucs97tjv") + Enum(); + +# Example 4a: Removing a resource from the allow and deny lists +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "configure_resource_deposit_rule" + Address("resource_sim1thcgx0f3rwaeetl67cmsssv4p748kd3sjhtge9l4m6ns7cucs97tjv") + Enum(); diff --git a/radix-engine-toolkit/tests/manifests/account/multi_account_resource_transfer.rtm b/radix-engine-toolkit/tests/manifests/account/multi_account_resource_transfer.rtm new file mode 100644 index 00000000..9030ae93 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/account/multi_account_resource_transfer.rtm @@ -0,0 +1,54 @@ +# This transaction shows how funds can be transferred from one account into multiple accounts all +# in a single transaction. In this example, imagine that we would like to send XRD to three accounts +# in the following quantities: +# Account A: 150 XRD +# Account B: 130 XRD +# Account C: 50 XRD +# Which is a total of 330 XRD. + +# ================================================================================================== +# 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. +# ================================================================================================== +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# Withdrawing 330 XRD from the account component +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "withdraw" + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") + Decimal("330"); + +# Taking 150 XRD from the worktop and depositing them into Account A +TAKE_FROM_WORKTOP + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") + Decimal("150") + Bucket("account_a_bucket"); +CALL_METHOD + Address("account_sim1c8mulhl5yrk6hh4jsyldps5sdrp08r5v9wusupvzxgqvhlp4c4nwjz") + "try_deposit_or_abort" + Bucket("account_a_bucket"); + +# Taking 130 XRD from the worktop and depositing them into Account B +TAKE_FROM_WORKTOP + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") + Decimal("130") + Bucket("account_b_bucket"); +CALL_METHOD + Address("account_sim1c8s2hass5g62ckwpv78y8ykdqljtetv4ve6etcz64gveykxznj36tr") + "try_deposit_or_abort" + Bucket("account_b_bucket"); + +# Taking 50 XRD from the worktop and depositing them into Account C +TAKE_FROM_WORKTOP + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") + Decimal("50") + Bucket("account_c_bucket"); +CALL_METHOD + Address("account_sim1c8ct6jdcwqrg3gzskyxuy0z933fe55fyjz6p56730r95ulzwl3ppva") + "try_deposit_or_abort" + Bucket("account_c_bucket"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/account/new.rtm b/radix-engine-toolkit/tests/manifests/account/new.rtm new file mode 100644 index 00000000..fc0283e3 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/account/new.rtm @@ -0,0 +1,9 @@ +# The below just gives some example syntax +# You shouldn't configure your account to have an "AllowAll" access! (apart from maybe for testing) +CREATE_ACCOUNT_ADVANCED + Enum( + Enum() + ) +; + +CREATE_ACCOUNT; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/account/resource_transfer.rtm b/radix-engine-toolkit/tests/manifests/account/resource_transfer.rtm new file mode 100644 index 00000000..9d3229d3 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/account/resource_transfer.rtm @@ -0,0 +1,26 @@ +# This transaction manifest shows how resources may be transferred between two accounts in a +# transaction. We will be withdrawing 100 XRD from our account component and depositing them in +# another account component. + +# ================================================================================================== +# 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. +# ================================================================================================== +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# Withdrawing 100 XRD from the account component +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "withdraw" + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") + Decimal("100"); + +# Depositing all of the XRD withdrawn from the account into the other account +CALL_METHOD + Address("account_sim1cyzfj6p254jy6lhr237s7pcp8qqz6c8ahq9mn6nkdjxxxat5syrgz9") + "try_deposit_batch_or_abort" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/call/call_function.rtm b/radix-engine-toolkit/tests/manifests/call/call_function.rtm new file mode 100644 index 00000000..58bcc9b6 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/call/call_function.rtm @@ -0,0 +1,5 @@ +CALL_FUNCTION + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + "BlueprintName" + "f" + "string"; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/call/call_method.rtm b/radix-engine-toolkit/tests/manifests/call/call_method.rtm new file mode 100644 index 00000000..fe5a3dbe --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/call/call_method.rtm @@ -0,0 +1,22 @@ +CALL_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "complicated_method" + Decimal("1") + PreciseDecimal("2"); + +CALL_ROYALTY_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "set_royalty" + "my_method" + Enum<0u8>(); + +CALL_METADATA_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "get" + "HelloWorld"; + +CALL_ACCESS_RULES_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "get_role" + Enum<0u8>() + "hello"; diff --git a/radix-engine-toolkit/tests/manifests/faucet/free_funds.rtm b/radix-engine-toolkit/tests/manifests/faucet/free_funds.rtm new file mode 100644 index 00000000..3c49a4d2 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/faucet/free_funds.rtm @@ -0,0 +1,27 @@ +# This transaction manifest shows how you can call into the testnet's faucet to get XRD. + +# ================================================================================================== +# 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 faucet component. Alternatively, we may also lock a fee from our +# 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 + Address("component_sim1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxhkrefh") + "lock_fee" + Decimal("500"); + +# Calling the "free" method on the faucet component which is the method responsible for dispensing +# XRD from the faucet. +CALL_METHOD + Address("component_sim1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxhkrefh") + "free"; + +# Depositing all of the XRD dispensed from the faucet into our account component. +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/identity/new.rtm b/radix-engine-toolkit/tests/manifests/identity/new.rtm new file mode 100644 index 00000000..b9cfe503 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/identity/new.rtm @@ -0,0 +1,4 @@ +CREATE_IDENTITY_ADVANCED + Enum(); + +CREATE_IDENTITY; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/metadata/metadata.rtm b/radix-engine-toolkit/tests/manifests/metadata/metadata.rtm new file mode 100644 index 00000000..bf6809a3 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/metadata/metadata.rtm @@ -0,0 +1,213 @@ +# Set String Metadata on Package +SET_METADATA + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + "field_name" + # "Metadata::String" is equivalent to 0u8 + Enum( + "Metadata string value, eg description" + ); + +# Set String Metadata on Account component +SET_METADATA + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "field_name" + # "Metadata::String" is equivalent to 0u8 + Enum( + "Metadata string value, eg description" + ); + +# Set String Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::String" is equivalent to 0u8 + Enum( + "Metadata string value, eg description" + ); + +# Set Bool Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Bool" is equivalent to 1u8 + Enum( + true + ); + +# Set u8 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::U8" is equivalent to 2u8 + Enum( + 123u8 + ); + +# Set u32 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::U32" is equivalent to 3u8 + Enum( + 123u32 + ); + +# Set u64 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::U64" is equivalent to 4u8 + Enum( + 123u64 + ); + +# Set i32 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::I32" is equivalent to 5u8 + Enum( + -123i32 + ); + +# Set i64 Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::I64" is equivalent to 6u8 + Enum( + -123i64 + ); + +# Set Decimal Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Decimal" is equivalent to 7u8 + Enum( # Single item + Decimal("10.5") + ); + +# Set Address Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Address" is equivalent to 8u8 + Enum( + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + ); + +# Set Public Key Metadata on Resource +# NOTE: Also see "PublicKeyHash" further down +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::PublicKey" is equivalent to 9u8 + Enum( + Enum( # 0u8 = Secp256k1, 1u8 = Ed25519 + # Hex-encoded canonical-Radix encoding of the public key + Bytes("0000000000000000000000000000000000000000000000000000000000000000ff") + ) + ); + +# Set NonFungibleGlobalId Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::NonFungibleGlobalId" is equivalent to 10u8 + Enum( + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:") + ); + +# Set NonFungibleLocalId Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::NonFungibleLocalId" is equivalent to 11u8 + Enum( + NonFungibleLocalId("") + ); + +# Set Instant (or the value in seconds since unix epoch) Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Instant" is equivalent to 12u8 + Enum( + # Value in seconds since Unix Epoch + 10000i64 + ); + +# Set Url Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Url" is equivalent to 13u8 + Enum( # Single item + "https://radixdlt.com/index.html" + ); + +# Set Origin Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::Origin" is equivalent to 14u8 + Enum( + "https://radixdlt.com" + ); + +# Set PublicKeyHash Metadata on Resource +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::PublicKeyHash" is equivalent to 15u8 + Enum( + Enum( # 0u8 = Secp256k1, 1u8 = Ed25519 + # The hex-encoded final 29 bytes of the Blake2b-256 hash of the public key bytes (in the canonical Radix encoding) + Bytes("0000000000000000000000000000000000000000000000000000000000") + ) + ); + +# Setting list-based metadata: +# ============================ +# If using enum discriminator aliases: Take "Metadata::X" and add Array to the end, eg "Metadata::XArray" +# If using u8 enum discriminators: Add 128 to the single values +# +# Then just make the content an Array. +# +# For example, for strings: +SET_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name" + # "Metadata::StringArray" is equivalent to 128u8 + Enum( + Array( + "some_string", + "another_string", + "yet_another_string" + ) + ); + +LOCK_METADATA + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + "field_name"; + +LOCK_METADATA + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "field_name"; + +LOCK_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name"; + +REMOVE_METADATA + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + "field_name"; + +REMOVE_METADATA + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "field_name"; + +REMOVE_METADATA + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + "field_name"; \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/package/code.wasm b/radix-engine-toolkit/tests/manifests/package/code.wasm new file mode 100644 index 00000000..1410dba7 Binary files /dev/null and b/radix-engine-toolkit/tests/manifests/package/code.wasm differ diff --git a/radix-engine-toolkit/tests/manifests/package/publish.rtm b/radix-engine-toolkit/tests/manifests/package/publish.rtm new file mode 100644 index 00000000..672e746d --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/package/publish.rtm @@ -0,0 +1,23 @@ +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("5000"); + +# Publishing a new package and setting some of its royalty and access rules. +PUBLISH_PACKAGE_ADVANCED + Enum() # Owner AccessRule + Tuple( # Package Definition + Map() + ) + Blob("a710f0959d8e139b3c1ca74ac4fcb9a95ada2c82e7f563304c5487e0117095c0") # Package Code + Map() # Metadata + None; # Address Reservation diff --git a/radix-engine-toolkit/tests/manifests/resources/auth_zone.rtm b/radix-engine-toolkit/tests/manifests/resources/auth_zone.rtm new file mode 100644 index 00000000..bc7b86f6 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/auth_zone.rtm @@ -0,0 +1,34 @@ +## NOTE: This manifest is not intended to make cohesive sense +## - it is more intended to demonstrate various authzone-related commands + +# Withdraw XRD from account +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "withdraw" Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("5.0"); + +# Create a proof from bucket, clone it and drop both +TAKE_ALL_FROM_WORKTOP Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Bucket("some_xrd"); +CREATE_PROOF_FROM_BUCKET_OF_AMOUNT Bucket("some_xrd") Decimal("1") Proof("proof1a"); +CREATE_PROOF_FROM_BUCKET_OF_NON_FUNGIBLES Bucket("some_xrd") Array(NonFungibleLocalId("#123#")) Proof("proof1b"); +CREATE_PROOF_FROM_BUCKET_OF_ALL Bucket("some_xrd") Proof("proof1c"); +CLONE_PROOF Proof("proof1c") Proof("proof1d"); +DROP_PROOF Proof("proof1d"); +DROP_PROOF Proof("proof1c"); +CLEAR_AUTH_ZONE; + +# Create a proof from account and drop it +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "create_proof_of_amount" Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") Decimal("5.0"); +POP_FROM_AUTH_ZONE Proof("proof3"); +DROP_PROOF Proof("proof3"); + +# Compose proofs +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "create_proof_of_amount" Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") Decimal("5.0"); +CREATE_PROOF_FROM_AUTH_ZONE_OF_AMOUNT Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") Decimal("1") Proof("proof4"); +CREATE_PROOF_FROM_AUTH_ZONE_OF_NON_FUNGIBLES Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") Array(NonFungibleLocalId("#123#")) Proof("proof5"); +CREATE_PROOF_FROM_AUTH_ZONE_OF_ALL Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") Proof("proof6"); +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_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "deposit_batch" Expression("ENTIRE_WORKTOP"); diff --git a/radix-engine-toolkit/tests/manifests/resources/creation/fungible/no_initial_supply.rtm b/radix-engine-toolkit/tests/manifests/resources/creation/fungible/no_initial_supply.rtm new file mode 100644 index 00000000..e0cc8369 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/creation/fungible/no_initial_supply.rtm @@ -0,0 +1,51 @@ +# This transaction manifest creates a new fungible resource with no initial supply and with the +# default auth. + +# ================================================================================================== +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# 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 + # Owner role - This gets metadata permissions, and is the default for other permissions + # Can set as Enum(access_rule) or Enum(access_rule) + Enum() + true # Whether the engine should track supply (avoid for massively parallelizable tokens) + 18u8 # Divisibility (between 0u8 and 18u8) + Tuple( + Some( # Mint Roles (if None: defaults to DenyAll, DenyAll) + Tuple( + Some(Enum()), # Minter (if None: defaults to Owner) + Some(Enum()) # Minter Updater (if None: defaults to Owner) + ) + ), + None, # Burn Roles (if None: defaults to DenyAll, DenyAll) + None, # Freeze Roles (if None: defaults to DenyAll, DenyAll) + None, # Recall Roles (if None: defaults to DenyAll, DenyAll) + None, # Withdraw Roles (if None: defaults to AllowAll, DenyAll) + None # Deposit Roles (if None: defaults to AllowAll, DenyAll) + ) + Tuple( # Metadata initialization + Map( # Initial metadata values + "name" => Tuple( + Some(Enum("MyResource")), # Resource Name + true # Locked + ) + ), + Map( # Metadata roles + "metadata_setter" => Some(Enum()), # Metadata setter role + "metadata_setter_updater" => None, # Metadata setter updater role as None defaults to OWNER + "metadata_locker" => Some(Enum()), # Metadata locker role + "metadata_locker_updater" => None # Metadata locker updater role as None defaults to OWNER + ) + ) + None; # No Address Reservation \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/resources/creation/fungible/with_initial_supply.rtm b/radix-engine-toolkit/tests/manifests/resources/creation/fungible/with_initial_supply.rtm new file mode 100644 index 00000000..93df44e9 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/creation/fungible/with_initial_supply.rtm @@ -0,0 +1,59 @@ +# This transaction manifest creates a new fungible resource with initial supply and with the default +# auth. + +# ================================================================================================== +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# 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_WITH_INITIAL_SUPPLY + # Owner role - This gets metadata permissions, and is the default for other permissions + # Can set as Enum(access_rule) or Enum(access_rule) + Enum() + true # Whether the engine should track supply (avoid for massively parallelizable tokens) + 18u8 # Divisibility (between 0u8 and 18u8) + Decimal("12") # Initial supply + Tuple( + Some( # Mint Roles (if None: defaults to DenyAll, DenyAll) + Tuple( + Some(Enum()), # Minter (if None: defaults to Owner) + Some(Enum()) # Minter Updater (if None: defaults to Owner) + ) + ), + None, # Burn Roles (if None: defaults to DenyAll, DenyAll) + None, # Freeze Roles (if None: defaults to DenyAll, DenyAll) + None, # Recall Roles (if None: defaults to DenyAll, DenyAll) + None, # Withdraw Roles (if None: defaults to AllowAll, DenyAll) + None # Deposit Roles (if None: defaults to AllowAll, DenyAll) + ) + Tuple( # Metadata initialization + Map( # Initial metadata values + "name" => Tuple( + Some(Enum("MyResource")), # Resource Name + true # Locked + ) + ), + Map( # Metadata roles + "metadata_setter" => Some(Enum()), # Metadata setter role + "metadata_setter_updater" => None, # Metadata setter updater role as None defaults to OWNER + "metadata_locker" => Some(Enum()), # Metadata locker role + "metadata_locker_updater" => None # Metadata locker updater role as None defaults to OWNER + ) + ) + None; # No Address Reservation + +# Depositing the entirety of the initial supply of the newly created resource into our account +# component. +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/resources/creation/non_fungible/no_initial_supply.rtm b/radix-engine-toolkit/tests/manifests/resources/creation/non_fungible/no_initial_supply.rtm new file mode 100644 index 00000000..c496d829 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/creation/non_fungible/no_initial_supply.rtm @@ -0,0 +1,52 @@ +# This transaction manifest creates a new non-fungible resource with no initial supply and with the +# default auth. + +# ================================================================================================== +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# Creating a new resource +CREATE_NON_FUNGIBLE_RESOURCE + # Owner role - This gets metadata permissions, and is the default for other permissions + # Can set as Enum(access_rule) or Enum(access_rule) + Enum() + Enum() # The type of NonFungible Id + true # Whether the engine should track supply (avoid for massively parallelizable tokens) + Tuple(Tuple(Array(), Array(), Array()), Enum<0u8>(64u8), Array()) # Non Fungible Data Schema + Tuple( + Some( # Mint Roles (if None: defaults to DenyAll, DenyAll) + Tuple( + Some(Enum()), # Minter (if None: defaults to Owner) + Some(Enum()) # Minter Updater (if None: defaults to Owner) + ) + ), + None, # Burn Roles (if None: defaults to DenyAll, DenyAll) + None, # Freeze Roles (if None: defaults to DenyAll, DenyAll) + None, # Recall Roles (if None: defaults to DenyAll, DenyAll) + None, # Withdraw Roles (if None: defaults to AllowAll, DenyAll) + None, # Deposit Roles (if None: defaults to AllowAll, DenyAll) + None # Non Fungible Data Update Roles (if None: defaults to DenyAll, DenyAll) + ) + Tuple( # Metadata initialization + Map( # Initial metadata values + "name" => Tuple( + Some(Enum("MyResource")), # Resource Name + true # Locked + ) + ), + Map( # Metadata roles + "metadata_setter" => Some(Enum()), # Metadata setter role + "metadata_setter_updater" => None, # Metadata setter updater role as None defaults to OWNER + "metadata_locker" => Some(Enum()), # Metadata locker role + "metadata_locker_updater" => None # Metadata locker updater role as None defaults to OWNER + ) + ) + None; # No Address Reservation \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/resources/creation/non_fungible/with_initial_supply.rtm b/radix-engine-toolkit/tests/manifests/resources/creation/non_fungible/with_initial_supply.rtm new file mode 100644 index 00000000..d4e1ef67 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/creation/non_fungible/with_initial_supply.rtm @@ -0,0 +1,62 @@ +# This transaction manifest creates a new non-fungible resource with initial supply and with the +# default auth. + +# ================================================================================================== +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# Creating a new resource +CREATE_NON_FUNGIBLE_RESOURCE_WITH_INITIAL_SUPPLY + # Owner role - This gets metadata permissions, and is the default for other permissions + # Can set as Enum(access_rule) or Enum(access_rule) + Enum() + Enum() # The type of NonFungible Id + true # Whether the engine should track supply (avoid for massively parallelizable tokens) + Tuple(Tuple(Array(), Array(), Array()), Enum<0u8>(64u8), Array()) # Non Fungible Data Schema + Map( # Initial supply to mint + NonFungibleLocalId("#12#") => Tuple(Tuple("Hello World", Decimal("12"))) + ) + Tuple( + Some( # Mint Roles (if None: defaults to DenyAll, DenyAll) + Tuple( + Some(Enum()), # Minter (if None: defaults to Owner) + Some(Enum()) # Minter Updater (if None: defaults to Owner) + ) + ), + None, # Burn Roles (if None: defaults to DenyAll, DenyAll) + None, # Freeze Roles (if None: defaults to DenyAll, DenyAll) + None, # Recall Roles (if None: defaults to DenyAll, DenyAll) + None, # Withdraw Roles (if None: defaults to AllowAll, DenyAll) + None, # Deposit Roles (if None: defaults to AllowAll, DenyAll) + None # Non Fungible Data Update Roles (if None: defaults to DenyAll, DenyAll) + ) + Tuple( # Metadata initialization + Map( # Initial metadata values + "name" => Tuple( + Some(Enum("MyResource")), # Resource Name + true # Locked + ) + ), + Map( # Metadata roles + "metadata_setter" => Some(Enum()), # Metadata setter role + "metadata_setter_updater" => None, # Metadata setter updater role as None defaults to OWNER + "metadata_locker" => Some(Enum()), # Metadata locker role + "metadata_locker_updater" => None # Metadata locker updater role as None defaults to OWNER + ) + ) + None; # No Address Reservation + +# Depositing the entirety of the initial supply of the newly created resource into our account +# component. +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/resources/freeze.rtm b/radix-engine-toolkit/tests/manifests/resources/freeze.rtm new file mode 100644 index 00000000..ca06afff --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/freeze.rtm @@ -0,0 +1,23 @@ +# Freeze Withdraws from a vault +FREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(1u32); + +# Freeze Deposits into a vault +FREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(2u32); + +# Freeze Burns in a vault +FREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(4u32); + +# Freeze Withdraws/Deposits/Burns of a vault +FREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(7u32); + +# Unfreeze Withdraws from a vault +UNFREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(1u32); + +# Unfreeze Deposits into a vault +UNFREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(2u32); + +# Unfreeze Burns in a vault +UNFREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(4u32); + +# Unfreeze Withdraws/Deposits/Burns of a vault +UNFREEZE_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Tuple(7u32); diff --git a/radix-engine-toolkit/tests/manifests/resources/mint/fungible/mint.rtm b/radix-engine-toolkit/tests/manifests/resources/mint/fungible/mint.rtm new file mode 100644 index 00000000..5ac8a048 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/mint/fungible/mint.rtm @@ -0,0 +1,37 @@ +# This transaction manifest shows how a mintable fungible resource may be minted through the +# transaction manifest. Most mint operations will typically require you to produce a badge before +# being allowed to mint a resource. This example is no different. In this example, there is a minter +# badge which we have in our account which allows us to mint this resource + +# ================================================================================================== +# 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 - Currently, the account component does not have +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "create_proof_of_amount" + Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") + Decimal("1"); + +# Minting some amount of tokens from the mintable fungible resource +MINT_FUNGIBLE + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Decimal("12"); + +# Depositing the entirety of the newly minted tokens into out account +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/resources/mint/non_fungible/mint.rtm b/radix-engine-toolkit/tests/manifests/resources/mint/non_fungible/mint.rtm new file mode 100644 index 00000000..7d1b09cd --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/mint/non_fungible/mint.rtm @@ -0,0 +1,41 @@ +# This transaction manifest shows how a mintable non-fungible resource may be minted through the +# transaction manifest. Most mint operations will typically require you to produce a badge before +# being allowed to mint a resource. This example is no different. In this example, there is a minter +# badge which we have in our account which allows us to mint this resource + +# ================================================================================================== +# 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 - Currently, the account component does not have +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "lock_fee" + Decimal("500"); + +# 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 + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "create_proof_of_amount" + Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") + 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 + Address("resource_sim1nfhtg7ttszgjwysfglx8jcjtvv8q02fg9s2y6qpnvtw5jsy3wvlhj6") + Map( + NonFungibleLocalId("#12#") => Tuple(Tuple()) + ); + +# Depositing the entirety of the newly minted tokens into out account +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "deposit_batch" + Expression("ENTIRE_WORKTOP"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/resources/recall.rtm b/radix-engine-toolkit/tests/manifests/resources/recall.rtm new file mode 100644 index 00000000..ff1f1d3a --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/recall.rtm @@ -0,0 +1 @@ +RECALL_FROM_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Decimal("1.2"); diff --git a/radix-engine-toolkit/tests/manifests/resources/recall_non_fungibles.rtm b/radix-engine-toolkit/tests/manifests/resources/recall_non_fungibles.rtm new file mode 100644 index 00000000..8b8b7e0b --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/recall_non_fungibles.rtm @@ -0,0 +1 @@ +RECALL_NON_FUNGIBLES_FROM_VAULT Address("internal_vault_sim1tqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvevp72ff") Array(NonFungibleLocalId("#123#"), NonFungibleLocalId("#456#")); diff --git a/radix-engine-toolkit/tests/manifests/resources/worktop.rtm b/radix-engine-toolkit/tests/manifests/resources/worktop.rtm new file mode 100644 index 00000000..cafdd9a9 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/resources/worktop.rtm @@ -0,0 +1,21 @@ +## NOTE: This manifest is not intended to make cohesive sense +## - it is more intended to demonstrate various worktop-related commands + +# Withdraw XRD from account +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "withdraw" Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("5.0"); + +# Buy GUM with XRD +TAKE_FROM_WORKTOP Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Decimal("2.0") Bucket("xrd"); +CALL_METHOD Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") "buy_gumball" Bucket("xrd"); +ASSERT_WORKTOP_CONTAINS_ANY Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez"); +ASSERT_WORKTOP_CONTAINS Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") Decimal("3.0"); + +# Create a proof from bucket, clone it and drop both +TAKE_ALL_FROM_WORKTOP Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") Bucket("some_xrd"); + +# Return a bucket to worktop +RETURN_TO_WORKTOP Bucket("some_xrd"); +TAKE_NON_FUNGIBLES_FROM_WORKTOP Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha") Array(NonFungibleLocalId("#1#")) Bucket("nfts"); + +# Move all resources in worktop to account +CALL_METHOD Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") "deposit_batch" Expression("ENTIRE_WORKTOP"); diff --git a/radix-engine-toolkit/tests/manifests/royalty/royalty.rtm b/radix-engine-toolkit/tests/manifests/royalty/royalty.rtm new file mode 100644 index 00000000..bd5624c6 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/royalty/royalty.rtm @@ -0,0 +1,14 @@ +SET_COMPONENT_ROYALTY + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "my_method" + Enum(); + +LOCK_COMPONENT_ROYALTY + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "my_method"; + +CLAIM_PACKAGE_ROYALTIES + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk"); + +CLAIM_COMPONENT_ROYALTIES + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q"); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/manifests/validator/new.rtm b/radix-engine-toolkit/tests/manifests/validator/new.rtm new file mode 100644 index 00000000..3cdbdcbd --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/validator/new.rtm @@ -0,0 +1,18 @@ +CALL_METHOD + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + "withdraw" + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") + Decimal("1000"); + +TAKE_FROM_WORKTOP + Address("resource_sim1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxakj8n3") + Decimal("1000") + Bucket("xrd_payment"); + +CREATE_VALIDATOR + # Secp256k1 Public Key Bytes + Bytes("02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5") + # Validator fee factor + Decimal("1") + # XRD payment + Bucket("xrd_payment"); diff --git a/radix-engine-toolkit/tests/manifests/values/values.rtm b/radix-engine-toolkit/tests/manifests/values/values.rtm new file mode 100644 index 00000000..08e5f377 --- /dev/null +++ b/radix-engine-toolkit/tests/manifests/values/values.rtm @@ -0,0 +1,73 @@ +TAKE_ALL_FROM_WORKTOP + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Bucket("temp1"); +CREATE_PROOF_FROM_AUTH_ZONE_OF_ALL + Address("resource_sim1thvwu8dh6lk4y9mntemkvj25wllq8adq42skzufp4m8wxxuemugnez") + Proof("temp2"); + +CALL_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "aliases" + + # enum + None + Enum<0u8>() + Some("hello") + Enum<1u8>( "hello") + Ok("test") + Enum<0u8>( "test") + Err("test123") + Enum<1u8>( "test123") + Enum() + Enum( "a") + Enum( "b") + Enum( "c") + + # bytes + Bytes("deadbeef") + Array(5u8, 10u8, 255u8) + + # non-fungible address + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:") + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:#123#") + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:#456#") + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") + NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:#1234567890#") + Tuple(Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha"), NonFungibleLocalId("#1#")) + + # array + Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) + Array(Bytes("dead"), Array(5u8, 10u8, 255u8)) + Array(NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:"), Tuple(Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha"), NonFungibleLocalId("#1#"))) + Array(NonFungibleGlobalId("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha:"), Tuple(Address("resource_sim1ngktvyeenvvqetnqwysevcx5fyvl6hqe36y3rkhdfdn6uzvt5366ha"), NonFungibleLocalId("#1#"))) + Array(Some("hello")) + Array(Enum<1u8>(), Enum()) + Array(Map()) + + # map + Map(1u8 => 5u16) +; + +CALL_METHOD + Address("component_sim1cqvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvemygpmu") + "custom_types" + + # Address + Address("package_sim1p4r4955skdjq9swg8s5jguvcjvyj7tsxct87a9z6sw76cdfd2jg3zk") + Address("account_sim1cyvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cve475w0q") + Address("consensusmanager_sim1scxxxxxxxxxxcnsmgrxxxxxxxxx000999665565xxxxxxxxxxc06cl") + Address("validator_sim1svzs2pg9q5zs2pg9q5zs2pg9q5zs2pg9q5zs2pg9q5zs2pg9wr6hj0") + Address("accesscontroller_sim1cvvgx33089ukm2pl97pv4max0x40ruvfy4lt60yvya744cvexaj7at") + + Bucket("temp1") + Proof("temp2") + Expression("ENTIRE_WORKTOP") + Blob("a710f0959d8e139b3c1ca74ac4fcb9a95ada2c82e7f563304c5487e0117095c0") + + Decimal("1.2") + PreciseDecimal("1.2") + NonFungibleLocalId("") + NonFungibleLocalId("#12#") + NonFungibleLocalId("[031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f]") + NonFungibleLocalId("{1111111111111111-1111111111111111-1111111111111111-1111111111111111}") +; diff --git a/radix-engine-toolkit/tests/proofs_visitor.rs b/radix-engine-toolkit/tests/proofs_visitor.rs deleted file mode 100644 index ea1ca7e4..00000000 --- a/radix-engine-toolkit/tests/proofs_visitor.rs +++ /dev/null @@ -1,170 +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 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 deleted file mode 100644 index 118dae04..00000000 --- a/radix-engine-toolkit/tests/statically_validate_transaction_tests.rs +++ /dev/null @@ -1,243 +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 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/manifest/access_controller/new.rtm b/radix-engine-toolkit/tests/test_vector/manifest/access_controller/new.rtm deleted file mode 100644 index defe124d..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/access_controller/new.rtm +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index a724b87d..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/access_rule/access_rule.rtm +++ /dev/null @@ -1,4 +0,0 @@ -SET_METHOD_ACCESS_RULE - 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 deleted file mode 100644 index fb645170..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/access_rule/assert_access_rule.rtm +++ /dev/null @@ -1,21 +0,0 @@ -CALL_METHOD - Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") - "lock_fee" - Decimal("10"); - -ASSERT_ACCESS_RULE - Enum( - "AccessRule::Protected", - Enum( - "AccessRuleNode::ProofRule", - Enum( - "ProofRule::Require", - Enum( - "SoftResourceOrNonFungible::StaticNonFungible", - NonFungibleGlobalId( - "${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}" - ) - ) - ) - ) - ); \ 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 deleted file mode 100644 index dd30cd2f..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/account/new.rtm +++ /dev/null @@ -1,2 +0,0 @@ -CREATE_ACCOUNT - Enum(0u8); \ 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 deleted file mode 100644 index 425d9507..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/call/call_function.rtm +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 01f62ed6..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/call/call_method.rtm +++ /dev/null @@ -1,5 +0,0 @@ -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/identity/new.rtm b/radix-engine-toolkit/tests/test_vector/manifest/identity/new.rtm deleted file mode 100644 index 4da4d183..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/identity/new.rtm +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100644 index fae0b2e3..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/metadata/metadata.rtm +++ /dev/null @@ -1,26 +0,0 @@ -SET_METADATA - Address("package_sim1qr46xrzzzlgvqccwqptp9ujlqncamd6kexux05essnuqc933em") - "k" - Enum(0u8, Enum(0u8, "v")); - -SET_METADATA - Address("account_sim1qnkhnw506drsfhrjrzaw4aj2yrucezvj2w7jqqqm5zds7mngxh") - "k" - Enum(0u8, Enum(0u8, "v")); - -SET_METADATA - Address("resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe") - "k" - 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 deleted file mode 100644 index f77da610..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/package/publish.rtm +++ /dev/null @@ -1,166 +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 - 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("${schema_blob_hash}") - Map() # Royalty Configuration - Map() # Metadata - Tuple( # Access Rules Struct - Map( # Method auth Field - Tuple( - Enum("NodeModuleId::SELF"), - "set_royalty_config" - ), - Enum( - "AccessRuleEntry::AccessRule", - Enum( - "AccessRule::Protected", - Enum( - "AccessRuleNode::ProofRule", - Enum( - "ProofRule::Require", - Enum( - "SoftResourceOrNonFungible::StaticNonFungible", - NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") - ) - ) - ) - ) - ), - Tuple( - Enum("NodeModuleId::SELF"), - "claim_royalty" - ), - Enum( - "AccessRuleEntry::AccessRule", - Enum( - "AccessRule::Protected", - Enum( - "AccessRuleNode::ProofRule", - Enum( - "ProofRule::Require", - Enum( - "SoftResourceOrNonFungible::StaticNonFungible", - NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") - ) - ) - ) - ) - ), - Tuple( - Enum("NodeModuleId::Metadata"), - "set" - ), - Enum( - "AccessRuleEntry::AccessRule", - Enum( - "AccessRule::Protected", - Enum( - "AccessRuleNode::ProofRule", - Enum( - "ProofRule::Require", - Enum( - "SoftResourceOrNonFungible::StaticNonFungible", - NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") - ) - ) - ) - ) - ), - Tuple( - Enum("NodeModuleId::Metadata"), - "get" - ), - Enum( - "AccessRuleEntry::AccessRule", - Enum("AccessRule::AllowAll") - ) - ), - Map(), # Grouped Auth Field - Enum("AccessRule::DenyAll"), # Default Auth Field - Map( # Method Auth Mutability Field - Tuple( - Enum("NodeModuleId::SELF"), - "set_royalty_config" - ), - Enum( - "AccessRule::Protected", - Enum( - "AccessRuleNode::ProofRule", - Enum( - "ProofRule::Require", - Enum( - "SoftResourceOrNonFungible::StaticNonFungible", - NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") - ) - ) - ) - ), - Tuple( - Enum("NodeModuleId::SELF"), - "claim_royalty" - ), - Enum( - "AccessRule::Protected", - Enum( - "AccessRuleNode::ProofRule", - Enum( - "ProofRule::Require", - Enum( - "SoftResourceOrNonFungible::StaticNonFungible", - NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") - ) - ) - ) - ), - Tuple( - Enum("NodeModuleId::Metadata"), - "set" - ), - Enum( - "AccessRule::Protected", - Enum( - "AccessRuleNode::ProofRule", - Enum( - "ProofRule::Require", - Enum( - "SoftResourceOrNonFungible::StaticNonFungible", - NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") - ) - ) - ) - ), - Tuple( - Enum("NodeModuleId::Metadata"), - "get" - ), - Enum( - "AccessRule::Protected", - Enum( - "AccessRuleNode::ProofRule", - Enum( - "ProofRule::Require", - Enum( - "SoftResourceOrNonFungible::StaticNonFungible", - NonFungibleGlobalId("${auth_badge_resource_address}:${auth_badge_non_fungible_local_id}") - ) - ) - ) - ) - ), - Map(), # Group Auth Mutability Field - Enum("AccessRule::DenyAll") # Default Auth Mutability Field - ); \ No newline at end of file diff --git a/radix-engine-toolkit/tests/test_vector/manifest/package/schema.blob b/radix-engine-toolkit/tests/test_vector/manifest/package/schema.blob deleted file mode 100644 index 0f54d027..00000000 Binary files a/radix-engine-toolkit/tests/test_vector/manifest/package/schema.blob and /dev/null differ 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 deleted file mode 100644 index edb2bb3a..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/auth_zone.rtm +++ /dev/null @@ -1,28 +0,0 @@ -# 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 deleted file mode 100644 index a61f4518..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/no_initial_supply.rtm +++ /dev/null @@ -1,54 +0,0 @@ -# This transaction manifest creates a new fungible resource with no initial supply and with the -# default auth. - -# ================================================================================================== -# 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 - 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 - 18u8 - Map( - "name", "MyResource", # Resource Name - "symbol", "RSRC", # Resource Symbol - "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 - # 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: - # 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 - # the future. - # - # 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 - # │ │ │ 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")) - ); \ 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 deleted file mode 100644 index 445382c1..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/fungible/with_initial_supply.rtm +++ /dev/null @@ -1,62 +0,0 @@ -# This transaction manifest creates a new fungible resource with initial supply and with the default -# auth. - -# ================================================================================================== -# 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 - 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_WITH_INITIAL_SUPPLY - 18u8 - Map( - "name", "MyResource", # Resource Name - "symbol", "RSRC", # Resource Symbol - "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 - # 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: - # 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 - # the future. - # - # 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 - # │ │ │ 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")) - ) - Decimal("${initial_supply}"); - -# Depositing the entirety of the initial supply of the newly created resource into our account -# component. -CALL_METHOD - 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/no_initial_supply.rtm b/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm deleted file mode 100644 index 1aa9e8c9..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/no_initial_supply.rtm +++ /dev/null @@ -1,53 +0,0 @@ -# This transaction manifest creates a new non-fungible resource with no initial supply and with the -# default auth. - -# ================================================================================================== -# 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 - 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 - # 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: - # 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 - # the future. - # - # 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 - # │ │ │ 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")) - ); \ 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 deleted file mode 100644 index b2f37d27..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/creation/non_fungible/with_initial_supply.rtm +++ /dev/null @@ -1,64 +0,0 @@ -# This transaction manifest creates a new non-fungible resource with initial supply and with the -# default auth. - -# ================================================================================================== -# 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 - Address("${account_component_address}") - "lock_fee" - Decimal("10"); - -# Creating a new 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 - ) - Map( - # 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: - # 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 - # the future. - # - # 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 - # │ │ │ 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")) - ) - 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 - 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 deleted file mode 100644 index b92f579b..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/recall.rtm +++ /dev/null @@ -1 +0,0 @@ -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 deleted file mode 100644 index dc401e1f..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/resources/worktop.rtm +++ /dev/null @@ -1,18 +0,0 @@ -# Withdraw XRD from account -CALL_METHOD Address("account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn") "withdraw" Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Decimal("5.0"); - -# Buy GUM with XRD -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 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#")) Address("resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k") Bucket("nfts"); - -# 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 deleted file mode 100644 index 14ff511a..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/royalty/royalty.rtm +++ /dev/null @@ -1,26 +0,0 @@ -SET_PACKAGE_ROYALTY_CONFIG - Address("package_sim1qr46xrzzzlgvqccwqptp9ujlqncamd6kexux05essnuqc933em") - Map( - "Blueprint", - Tuple( - Map( - "method", 1u32 - ), - 0u32 - ) - ); - -SET_COMPONENT_ROYALTY_CONFIG - Address("account_sim1qnkhnw506drsfhrjrzaw4aj2yrucezvj2w7jqqqm5zds7mngxh") - Tuple( - Map( - "method", 1u32 - ), - 0u32 - ); - -CLAIM_PACKAGE_ROYALTY - Address("package_sim1qr46xrzzzlgvqccwqptp9ujlqncamd6kexux05essnuqc933em"); - -CLAIM_COMPONENT_ROYALTY - 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 deleted file mode 100644 index 4689d358..00000000 --- a/radix-engine-toolkit/tests/test_vector/manifest/values/values.rtm +++ /dev/null @@ -1,66 +0,0 @@ -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/schema/Cargo.toml b/schema/Cargo.toml deleted file mode 100644 index e74736e6..00000000 --- a/schema/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "schema" -version = "0.9.0" -edition = "2021" - -[dependencies] -# A library which allows us to generate a JSON schema from Rust models -schemars = { version = "0.8.11", features = ["preserve_order"] } - -# Used to serialize the schema to JSON -serde_json = "1.0.91" - -# Importing core to get the models to generate it -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 = "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 deleted file mode 100644 index d7e693bd..00000000 --- a/schema/out/examples/request-examples.md +++ /dev/null @@ -1,2518 +0,0 @@ -# Requests Examples - -This document contains examples and descriptions of the different requests and responses which the Radix Engine Toolkit may provide. As long as all of the CI test pass, then you may treat this document as the canonical truth for the format of the different requests and as valid examples of the payload and responses of these requests. - - -## Information - -| 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. | -| Required Features | default | -| Request Type | `InformationRequest` | -| Response Type | `InformationResponse` | - -
- Request Example - -```json -{} -``` -
- -
- Response Example - -```json -{ - "package_version": "0.9.0", - "last_commit_hash": "This is just an example. We don't have a commit hash here" -} -``` -
- -## Convert Manifest - -| 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. | -| Required Features | default | -| Request Type | `ConvertManifestRequest` | -| Response Type | `ConvertManifestResponse` | - -
- Request Example - -```json -{ - "network_id": "242", - "instructions_output_kind": "Parsed", - "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": [] - } -} -``` -
- -
- Response Example - -```json -{ - "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": [] -} -``` -
- -## Analyze Manifest - -| 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. | -| Required Features | default | -| Request Type | `AnalyzeManifestRequest` | -| Response Type | `AnalyzeManifestResponse` | - -
- Request Example - -```json -{ - "network_id": "242", - "manifest": { - "instructions": { - "type": "String", - "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": [] - } -} -``` -
- -
- Response Example - -```json -{ - "package_addresses": [], - "component_addresses": [ - { - "type": "ComponentAddress", - "address": "component_sim1qd8djmepmq7hxqaakt9rl3hkce532px42s8eh4qmqlks9f87dn" - }, - { - "type": "ComponentAddress", - "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" - } - ], - "resource_addresses": [ - { - "type": "ResourceAddress", - "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" - }, - { - "type": "ResourceAddress", - "address": "resource_sim1q2ym536cwvvf3cy9p777t4qjczqwf79hagp3wn93srvsgvqtwe" - } - ], - "account_addresses": [ - { - "type": "ComponentAddress", - "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" - } - ], - "accounts_requiring_auth": [ - { - "type": "ComponentAddress", - "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" - } - ], - "accounts_withdrawn_from": [ - { - "type": "ComponentAddress", - "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" - } - ], - "accounts_deposited_into": [ - { - "type": "ComponentAddress", - "address": "account_sim1qjy5fakwygc45fkyhyxxulsf5zfae0ycez0x05et9hqs7d0gtn" - } - ] -} -``` -
- -## Compile Transaction Intent - -| 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. | -| Required Features | default | -| Request Type | `CompileTransactionIntentRequest` | -| Response Type | `CompileTransactionIntentResponse` | - -
- Request Example - -```json -{ - "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": [] - } -} -``` -
- -
- Response Example - -```json -{ - "compiled_intent": "4d21022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f626174636821018300202000" -} -``` -
- -## Decompile Transaction Intent - -| 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. | -| Required Features | default | -| Request Type | `DecompileTransactionIntentRequest` | -| Response Type | `DecompileTransactionIntentResponse` | - -
- Request Example - -```json -{ - "instructions_output_kind": "Parsed", - "compiled_intent": "4d21022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f626174636821018300202000" -} -``` -
- -
- Response Example - -```json -{ - "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": [] - } -} -``` -
- -## Compile Signed Transaction Intent - -| 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. | -| Required Features | default | -| Request Type | `CompileSignedTransactionIntentRequest` | -| Response Type | `CompileSignedTransactionIntentResponse` | - -
- Request Example - -```json -{ - "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" - } - ] -} -``` -
- -
- Response Example - -```json -{ - "compiled_intent": "4d210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d" -} -``` -
- -## Decompile Signed Transaction Intent - -| 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. | -| Required Features | default | -| Request Type | `DecompileSignedTransactionIntentRequest` | -| Response Type | `DecompileSignedTransactionIntentResponse` | - -
- Request Example - -```json -{ - "instructions_output_kind": "Parsed", - "compiled_signed_intent": "4d210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d" -} -``` -
- -
- Response Example - -```json -{ - "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" - } - ] -} -``` -
- -## Compile Notarized Transaction - -| 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 | -| Required Features | default | -| Request Type | `CompileNotarizedTransactionRequest` | -| Response Type | `CompileNotarizedTransactionResponse` | - -
- Request Example - -```json -{ - "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" - } -} -``` -
- -
- Response Example - -```json -{ - "compiled_intent": "4d2102210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d2200012101200741005f9290847274a47ce592718db3b1d7ace56db9fbcbc9139cd9e680715f7a316a535cccd292b1176e8d25a2b5dfc6907fc0527c8f5bd36db750a02972945bc6d7" -} -``` -
- -## Decompile Notarized Transaction - -| 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. | -| Required Features | default | -| Request Type | `DecompileNotarizedTransactionRequest` | -| Response Type | `DecompileNotarizedTransactionResponse` | - -
- Request Example - -```json -{ - "instructions_output_kind": "Parsed", - "compiled_notarized_intent": "4d2102210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d2200012101200741005f9290847274a47ce592718db3b1d7ace56db9fbcbc9139cd9e680715f7a316a535cccd292b1176e8d25a2b5dfc6907fc0527c8f5bd36db750a02972945bc6d7" -} -``` -
- -
- Response Example - -```json -{ - "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" - } -} -``` -
- -## Decompile Unknown Transaction Intent - -| Function Name | `decompile_unknown_transaction_intent` | -| ----------------- | :----------------- | -| 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 -{ - "instructions_output_kind": "Parsed", - "compiled_unknown_intent": "4d2102210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d2200012101200741005f9290847274a47ce592718db3b1d7ace56db9fbcbc9139cd9e680715f7a316a535cccd292b1176e8d25a2b5dfc6907fc0527c8f5bd36db750a02972945bc6d7" -} -``` -
- -
- Response Example - -```json -{ - "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" - } - } -} -``` -
- -## Encode Address - -| Function Name | `encode_address` | -| ----------------- | :----------------- | -| 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_bytes": "000000000000000000000000000000000000000000000000000002", - "network_id": "242" -} -``` -
- -
- Response Example - -```json -{ - "type": "PackageAddress", - "address": "package_sim1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqmre2w5" -} -``` -
- -## Decode Address - -| Function Name | `decode_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. | -| Required Features | default | -| Request Type | `DecodeAddressRequest` | -| Response Type | `DecodeAddressResponse` | - -
- Request Example - -```json -{ - "address": "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k" -} -``` -
- -
- Response Example - -```json -{ - "network_id": "242", - "network_name": "simulator", - "entity_type": "FungibleResource", - "data": "010000000000000000000000000000000000000000000000000000", - "hrp": "resource_sim" -} -``` -
- -## Sbor Encode - -| Function Name | `sbor_encode` | -| ----------------- | :----------------- | -| 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 -{ - "type": "ScryptoSbor", - "value": { - "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" - } - ] - } - ] - } - ] - } - ] - } - ] - } -} -``` -
- -
- 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. | -| Required Features | default | -| Request Type | `DeriveVirtualAccountAddressRequest` | -| Response Type | `DeriveVirtualAccountAddressResponse` | - -
- Request Example - -```json -{ - "network_id": "242", - "public_key": { - "curve": "EcdsaSecp256k1", - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } -} -``` -
- -
- Response Example - -```json -{ - "virtual_account_address": { - "type": "ComponentAddress", - "address": "account_sim1ppkfdmv0q2cwz9cjxk5t8u0zx6pdydd9p2jv22nuwdhqyn4rgj" - } -} -``` -
- -## Derive Virtual Identity Address - -| 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. | -| Required Features | default | -| Request Type | `DeriveVirtualIdentityAddressRequest` | -| Response Type | `DeriveVirtualIdentityAddressResponse` | - -
- Request Example - -```json -{ - "network_id": "242", - "public_key": { - "curve": "EcdsaSecp256k1", - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } -} -``` -
- -
- Response Example - -```json -{ - "virtual_identity_address": { - "type": "ComponentAddress", - "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" - } -} -``` -
- -## Derive Non Fungible Global Id From Public Key - -| 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 | -| Required Features | default | -| Request Type | `DeriveNonFungibleGlobalIdFromPublicKeyRequest` | -| Response Type | `DeriveNonFungibleGlobalIdFromPublicKeyResponse` | - -
- Request Example - -```json -{ - "network_id": "242", - "public_key": { - "curve": "EcdsaSecp256k1", - "public_key": "03c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa21" - } -} -``` -
- -
- Response Example - -```json -{ - "non_fungible_global_id": { - "resource_address": { - "type": "ResourceAddress", - "address": "resource_sim1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq056vhf" - }, - "non_fungible_local_id": { - "type": "Bytes", - "value": "6c96ed8f02b0e1171235a8b3f1e23682d235a50aa4c52a7c736e" - } - } -} -``` -
- -## Statically Validate Transaction - -| Function Name | `statically_validate_transaction` | -| ----------------- | :----------------- | -| JNI Function Name | `Java_RadixEngineToolkitFFI_staticallyValidateTransaction` | -| Functionality | Performs static validation on the given notarized transaction. | -| Required Features | default | -| Request Type | `StaticallyValidateTransactionRequest` | -| Response Type | `StaticallyValidateTransactionResponse` | - -
- Request Example - -```json -{ - "compiled_notarized_intent": "4d2102210221022109070107f20a00020000000000000a10020000000000000a220000000000000022000120072103c32f9761dd3f961a3d12747e54db6b821bd022ef92b9ebf591bfe186885baa2101010900e1f5050800002102202209210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c087769746864726177210280010000000000000000000000000000000000000000000000000000850000f444829163450000000000000000000000000000000000000000000000000102850000c84e676dc11b00000000000000000000000000000000000000000000000080010000000000000000000000000000000000000000000000000000210380034ed96f21d83d7303bdb2ca3fc6f6c6691504d5540f9bd41b07ed0c0b6275795f67756d62616c6c2101810000000005028500002cf61a24a229000000000000000000000000000000000000000000000000800100000000000000000000000000000000000000000000000000000401800289ba4758731898e0850fbde5d412c080e4f8b7ea03174cb180d900018001000000000000000000000000000000000000000000000000000003018101000000020220870101000000000000000180010000000000000000000000000000000000000000000000000000210380048944f6ce22315a26c4b90c6e7e09a093dcbc98c89e67d32b2dc10c0d6465706f7369745f62617463682101830020200020220600012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a7400012101200741008b86278af6e6336c8e7a3d635f0fec9c467588397c4df4818f32e897238f2a3c1edb19118c9d9a09f9c2f98506486e96db89acc987a5b3dee4861e01ca8761d0000121012007410075a6696b28b00b4295ffdfeaf852e52736f8fbd2314e1ea087ce0215b799cba14a98d918be28cf71ed51eaa58d7b88e1a15ef50297e04ec97dbad77d7702784e01022007204cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2921012007402a310d3ed1eacc1ccf3b7d59a91a6474415c647f55af42e2e912dc850b79f7418108a1bed1ee34103530372b1899853fff078c32b5e590bb718f74a1df32400a01022007207422b9887598068e32c4448a949adb290d0f4e35b9e01b0ee5f1a1e600fe267421012007407eb1c121969dfba6cf43695a12f889e15081407ea455396cb02acdc101b277618531cb9a231ec48798c02c0bb73f9350f0e58bda6b6c8b6b5d6416ecd1f218010102200720f381626e41e7027ea431bfe3009e94bdd25a746beec468948d6c3c7c5dc9a54b2101200740c2277b73ff69e7e63b1c5ec98b23f71d7e419df1c69d5e58d4a73a9bdb18192b72f64410c7e19e7b88fd339112c8171928ae3669f39cad38050eb48a8ecb3c0d2200012101200741001dc81ce1fd9b1de438972231e81db2cab2ec01f205019c7e947b2ef049c18763283394f18f7efd1ede7122a5b0ae68bcab671c6f28a83061c13c1b7413728a74", - "validation_config": { - "network_id": "242", - "min_cost_unit_limit": "1000000", - "max_cost_unit_limit": "100000000", - "min_tip_percentage": "0", - "max_tip_percentage": "65535", - "max_epoch_range": "100" - } -} -``` -
- -
- Response Example - -```json -{ - "validity": "Invalid", - "error": "SignatureValidationError(InvalidNotarySignature)" -} -``` -
- -## Known Entity Addresses - -| 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). | -| Required Features | default | -| Request Type | `KnownEntityAddressesRequest` | -| Response Type | `KnownEntityAddressesResponse` | - -
- Request Example - -```json -{ - "network_id": "1" -} -``` -
- -
- Response Example - -```json -{ - "faucet_component_address": { - "type": "ComponentAddress", - "address": "component_rdx1q0kryz5scup945usk39qjc2yjh6l5zsyuh8t7v5pk0ts3s4rve" - }, - "faucet_package_address": { - "type": "PackageAddress", - "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqqs767h4" - }, - "account_package_address": { - "type": "PackageAddress", - "address": "package_rdx1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzsew9vdj" - }, - "xrd_resource_address": { - "type": "ResourceAddress", - "address": "resource_rdx1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqkcg7wf" - }, - "system_token_resource_address": { - "type": "ResourceAddress", - "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpqxts0hs" - }, - "ecdsa_secp256k1_token_resource_address": { - "type": "ResourceAddress", - "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk" - }, - "eddsa_ed25519_token_resource_address": { - "type": "ResourceAddress", - "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsuhhdf9" - }, - "package_token_resource_address": { - "type": "ResourceAddress", - "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpsn2chzr" - }, - "epoch_manager_system_address": { - "type": "ComponentAddress", - "address": "epochmanager_rdx1q5qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqcmqvad" - }, - "clock_system_address": { - "type": "ComponentAddress", - "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 deleted file mode 100644 index e2f21235..00000000 --- a/schema/out/schema/analyze_manifest_request.json +++ /dev/null @@ -1,4529 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AnalyzeManifestRequest", - "description": "Analyzes the passed manifest to determine the entities that this manifest interacts with.", - "type": "object", - "required": [ - "manifest", - "network_id" - ], - "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" - } - ] - } - }, - "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_response.json b/schema/out/schema/analyze_manifest_response.json deleted file mode 100644 index f2935de5..00000000 --- a/schema/out/schema/analyze_manifest_response.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "AnalyzeManifestResponse", - "description": "The response of the [`AnalyzeManifestRequest`]", - "type": "object", - "required": [ - "account_addresses", - "accounts_deposited_into", - "accounts_requiring_auth", - "accounts_withdrawn_from", - "component_addresses", - "package_addresses", - "resource_addresses" - ], - "properties": { - "package_addresses": { - "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/EntityAddress" - }, - "uniqueItems": true - }, - "component_addresses": { - "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/EntityAddress" - }, - "uniqueItems": true - }, - "resource_addresses": { - "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/EntityAddress" - }, - "uniqueItems": true - }, - "account_addresses": { - "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/EntityAddress" - }, - "uniqueItems": true - }, - "accounts_requiring_auth": { - "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/EntityAddress" - }, - "uniqueItems": true - }, - "accounts_withdrawn_from": { - "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/EntityAddress" - }, - "uniqueItems": true - }, - "accounts_deposited_into": { - "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/EntityAddress" - }, - "uniqueItems": true - } - }, - "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" - } - } - } - ] - } - } -} \ 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 deleted file mode 100644 index c40d03e7..00000000 --- a/schema/out/schema/analyze_manifest_with_preview_context_request.json +++ /dev/null @@ -1,4535 +0,0 @@ -{ - "$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 deleted file mode 100644 index 0320505a..00000000 --- a/schema/out/schema/analyze_manifest_with_preview_context_response.json +++ /dev/null @@ -1,553 +0,0 @@ -{ - "$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 deleted file mode 100644 index 5dd0aa52..00000000 --- a/schema/out/schema/compile_notarized_transaction_request.json +++ /dev/null @@ -1,5033 +0,0 @@ -{ - "$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", - "signed_intent" - ], - "properties": { - "signed_intent": { - "description": "The signed transaction intent of the transaction.", - "allOf": [ - { - "$ref": "#/definitions/SignedTransactionIntent" - } - ] - }, - "notary_signature": { - "description": "The signature of the notary on the signed transaction intent.", - "allOf": [ - { - "$ref": "#/definitions/Signature" - } - ] - } - }, - "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", - "intent_signatures" - ], - "properties": { - "intent": { - "description": "The intent of the transaction.", - "allOf": [ - { - "$ref": "#/definitions/TransactionIntent" - } - ] - }, - "intent_signatures": { - "description": "A vector of transaction intent signatures.", - "type": "array", - "items": { - "$ref": "#/definitions/SignatureWithPublicKey" - } - } - } - }, - "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", - "manifest" - ], - "properties": { - "header": { - "description": "A transaction header of the transaction metadata.", - "allOf": [ - { - "$ref": "#/definitions/TransactionHeader" - } - ] - }, - "manifest": { - "description": "A transaction manifest of the transaction instructions and blobs.", - "allOf": [ - { - "$ref": "#/definitions/TransactionManifest" - } - ] - } - } - }, - "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", - "end_epoch_exclusive", - "network_id", - "nonce", - "notary_as_signatory", - "notary_public_key", - "start_epoch_inclusive", - "tip_percentage", - "version" - ], - "properties": { - "version": { - "description": "An 8 bit unsigned integer serialized as a string which represents the transaction version. Currently, this value is always 1.", - "type": "string" - }, - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that this transaction is meant for.", - "type": "string" - }, - "start_epoch_inclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the start of the epoch window in which this transaction executes. This value is inclusive.", - "type": "string" - }, - "end_epoch_exclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the end of the epoch window in which this transaction executes. This value is exclusive.", - "type": "string" - }, - "nonce": { - "description": "A 64 bit unsigned integer serialized as a string which represents a random nonce used for this transaction.", - "type": "string" - }, - "notary_public_key": { - "description": "The public key of the entity that will be notarizing this transaction.", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - }, - "notary_as_signatory": { - "description": "When `true` the notary's signature is also treated as an intent signature and therefore a virtual badge of the signature is added to the auth zone when the transaction auth zone at the beginning of the transaction.", - "type": "boolean" - }, - "cost_unit_limit": { - "description": "A 32 bit unsigned integer serialized as a string which represents the limit or maximum amount of cost units that the transaction is allowed to use.", - "type": "string" - }, - "tip_percentage": { - "description": "A 16 bit unsigned integer serialized as a string which represents the percentage of tips given to validators for this transaction.", - "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]+" - } - } - } - ] - }, - "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]+" - }, - "SignatureWithPublicKey": { - "description": "A discriminated union of the possible pairs of signatures and public keys used by Scrypto and the Radix Engine.", - "oneOf": [ - { - "description": "Cryptographic signature and public key for Ecdsa Secp256k1", - "examples": [ - { - "curve": "EcdsaSecp256k1", - "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" - } - ], - "type": "object", - "required": [ - "curve", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EcdsaSecp256k1" - ] - }, - "signature": { - "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. In this case, only a signature is needed since the public key can be derived from the signature if the message is available.", - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Cryptographic signature and public key for EdDSA Ed25519", - "examples": [ - { - "curve": "EddsaEd25519", - "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" - } - ], - "type": "object", - "required": [ - "curve", - "public_key", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EddsaEd25519" - ] - }, - "public_key": { - "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": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - }, - "signature": { - "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": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - } - ] - }, - "Signature": { - "description": "A discriminated union of the possible cryptographic signatures used by Scrypto and the Radix Engine.", - "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", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EcdsaSecp256k1" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "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.", - "examples": [ - { - "curve": "EddsaEd25519", - "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" - } - ], - "type": "object", - "required": [ - "curve", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EddsaEd25519" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - } - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/compile_notarized_transaction_response.json b/schema/out/schema/compile_notarized_transaction_response.json deleted file mode 100644 index 496bd19e..00000000 --- a/schema/out/schema/compile_notarized_transaction_response.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "CompileNotarizedTransactionResponse", - "description": "The response from [`CompileNotarizedTransactionRequest`].", - "type": "object", - "required": [ - "compiled_intent" - ], - "properties": { - "compiled_intent": { - "description": "A byte array serialized as a hex string which represents the compiled notarized transaction intent.", - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } -} \ No newline at end of file diff --git a/schema/out/schema/compile_signed_transaction_intent_request.json b/schema/out/schema/compile_signed_transaction_intent_request.json deleted file mode 100644 index 2c2aab48..00000000 --- a/schema/out/schema/compile_signed_transaction_intent_request.json +++ /dev/null @@ -1,4871 +0,0 @@ -{ - "$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", - "intent_signatures" - ], - "properties": { - "intent": { - "description": "The intent of the transaction.", - "allOf": [ - { - "$ref": "#/definitions/TransactionIntent" - } - ] - }, - "intent_signatures": { - "description": "A vector of transaction intent signatures.", - "type": "array", - "items": { - "$ref": "#/definitions/SignatureWithPublicKey" - } - } - }, - "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", - "manifest" - ], - "properties": { - "header": { - "description": "A transaction header of the transaction metadata.", - "allOf": [ - { - "$ref": "#/definitions/TransactionHeader" - } - ] - }, - "manifest": { - "description": "A transaction manifest of the transaction instructions and blobs.", - "allOf": [ - { - "$ref": "#/definitions/TransactionManifest" - } - ] - } - } - }, - "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", - "end_epoch_exclusive", - "network_id", - "nonce", - "notary_as_signatory", - "notary_public_key", - "start_epoch_inclusive", - "tip_percentage", - "version" - ], - "properties": { - "version": { - "description": "An 8 bit unsigned integer serialized as a string which represents the transaction version. Currently, this value is always 1.", - "type": "string" - }, - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that this transaction is meant for.", - "type": "string" - }, - "start_epoch_inclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the start of the epoch window in which this transaction executes. This value is inclusive.", - "type": "string" - }, - "end_epoch_exclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the end of the epoch window in which this transaction executes. This value is exclusive.", - "type": "string" - }, - "nonce": { - "description": "A 64 bit unsigned integer serialized as a string which represents a random nonce used for this transaction.", - "type": "string" - }, - "notary_public_key": { - "description": "The public key of the entity that will be notarizing this transaction.", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - }, - "notary_as_signatory": { - "description": "When `true` the notary's signature is also treated as an intent signature and therefore a virtual badge of the signature is added to the auth zone when the transaction auth zone at the beginning of the transaction.", - "type": "boolean" - }, - "cost_unit_limit": { - "description": "A 32 bit unsigned integer serialized as a string which represents the limit or maximum amount of cost units that the transaction is allowed to use.", - "type": "string" - }, - "tip_percentage": { - "description": "A 16 bit unsigned integer serialized as a string which represents the percentage of tips given to validators for this transaction.", - "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]+" - } - } - } - ] - }, - "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]+" - }, - "SignatureWithPublicKey": { - "description": "A discriminated union of the possible pairs of signatures and public keys used by Scrypto and the Radix Engine.", - "oneOf": [ - { - "description": "Cryptographic signature and public key for Ecdsa Secp256k1", - "examples": [ - { - "curve": "EcdsaSecp256k1", - "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" - } - ], - "type": "object", - "required": [ - "curve", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EcdsaSecp256k1" - ] - }, - "signature": { - "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. In this case, only a signature is needed since the public key can be derived from the signature if the message is available.", - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Cryptographic signature and public key for EdDSA Ed25519", - "examples": [ - { - "curve": "EddsaEd25519", - "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" - } - ], - "type": "object", - "required": [ - "curve", - "public_key", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EddsaEd25519" - ] - }, - "public_key": { - "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": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - }, - "signature": { - "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": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - } - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/compile_signed_transaction_intent_response.json b/schema/out/schema/compile_signed_transaction_intent_response.json deleted file mode 100644 index 97030e76..00000000 --- a/schema/out/schema/compile_signed_transaction_intent_response.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "CompileSignedTransactionIntentResponse", - "description": "The response from [`CompileSignedTransactionIntentRequest`].", - "type": "object", - "required": [ - "compiled_intent" - ], - "properties": { - "compiled_intent": { - "description": "A byte array serialized as a hex string which represents the compiled signed transaction intent.", - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } -} \ No newline at end of file diff --git a/schema/out/schema/compile_transaction_intent_request.json b/schema/out/schema/compile_transaction_intent_request.json deleted file mode 100644 index c645f368..00000000 --- a/schema/out/schema/compile_transaction_intent_request.json +++ /dev/null @@ -1,4705 +0,0 @@ -{ - "$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", - "manifest" - ], - "properties": { - "header": { - "description": "A transaction header of the transaction metadata.", - "allOf": [ - { - "$ref": "#/definitions/TransactionHeader" - } - ] - }, - "manifest": { - "description": "A transaction manifest of the transaction instructions and blobs.", - "allOf": [ - { - "$ref": "#/definitions/TransactionManifest" - } - ] - } - }, - "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", - "end_epoch_exclusive", - "network_id", - "nonce", - "notary_as_signatory", - "notary_public_key", - "start_epoch_inclusive", - "tip_percentage", - "version" - ], - "properties": { - "version": { - "description": "An 8 bit unsigned integer serialized as a string which represents the transaction version. Currently, this value is always 1.", - "type": "string" - }, - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that this transaction is meant for.", - "type": "string" - }, - "start_epoch_inclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the start of the epoch window in which this transaction executes. This value is inclusive.", - "type": "string" - }, - "end_epoch_exclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the end of the epoch window in which this transaction executes. This value is exclusive.", - "type": "string" - }, - "nonce": { - "description": "A 64 bit unsigned integer serialized as a string which represents a random nonce used for this transaction.", - "type": "string" - }, - "notary_public_key": { - "description": "The public key of the entity that will be notarizing this transaction.", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - }, - "notary_as_signatory": { - "description": "When `true` the notary's signature is also treated as an intent signature and therefore a virtual badge of the signature is added to the auth zone when the transaction auth zone at the beginning of the transaction.", - "type": "boolean" - }, - "cost_unit_limit": { - "description": "A 32 bit unsigned integer serialized as a string which represents the limit or maximum amount of cost units that the transaction is allowed to use.", - "type": "string" - }, - "tip_percentage": { - "description": "A 16 bit unsigned integer serialized as a string which represents the percentage of tips given to validators for this transaction.", - "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]+" - } - } - } - ] - }, - "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/compile_transaction_intent_response.json b/schema/out/schema/compile_transaction_intent_response.json deleted file mode 100644 index 0d2eec79..00000000 --- a/schema/out/schema/compile_transaction_intent_response.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "CompileTransactionIntentResponse", - "description": "The response from [`CompileTransactionIntentRequest`].", - "type": "object", - "required": [ - "compiled_intent" - ], - "properties": { - "compiled_intent": { - "description": "A byte array serialized as a hex string which represents the compiled transaction intent.", - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } -} \ No newline at end of file diff --git a/schema/out/schema/convert_manifest_request.json b/schema/out/schema/convert_manifest_request.json deleted file mode 100644 index ed69e337..00000000 --- a/schema/out/schema/convert_manifest_request.json +++ /dev/null @@ -1,4546 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "ConvertManifestRequest", - "description": "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.\n\nTherefore, 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. If a JSON interface for the Radix Engine Toolkit is used, then the parsed instructions will be all in JSON.\n\nThis function allows the client the convert their manifest between the two supported manifest types: string and parsed.", - "type": "object", - "required": [ - "instructions_output_kind", - "manifest", - "network_id" - ], - "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]+" - }, - "instructions_output_kind": { - "description": "Defines the output format that we would like the manifest to be in after this request is performed.", - "allOf": [ - { - "$ref": "#/definitions/InstructionKind" - } - ] - }, - "manifest": { - "description": "The manifest to convert to the format described by `instructions_output_kind`", - "allOf": [ - { - "$ref": "#/definitions/TransactionManifest" - } - ] - } - }, - "definitions": { - "InstructionKind": { - "description": "An enum which describes the kind of manifest instructions.", - "type": "string", - "enum": [ - "String", - "Parsed" - ] - }, - "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/convert_manifest_response.json b/schema/out/schema/convert_manifest_response.json deleted file mode 100644 index 5d79b043..00000000 --- a/schema/out/schema/convert_manifest_response.json +++ /dev/null @@ -1,4506 +0,0 @@ -{ - "$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", - "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" - } - } - }, - "definitions": { - "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/decode_address_request.json b/schema/out/schema/decode_address_request.json deleted file mode 100644 index ba637982..00000000 --- a/schema/out/schema/decode_address_request.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DecodeAddressRequest", - "description": "This request can be used to decode a Bech32m encoded address string into its equivalent hrp and data. In addition to that, this request 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.", - "type": "object", - "required": [ - "address" - ], - "properties": { - "address": { - "description": "A string of the Bech32m encoded address to decode. Decoding this address will expose its entity type, network id, network name, underlying data, as well as it's Bech32m HRP.", - "type": "string" - } - } -} \ No newline at end of file diff --git a/schema/out/schema/decode_address_response.json b/schema/out/schema/decode_address_response.json deleted file mode 100644 index 1e1ebae7..00000000 --- a/schema/out/schema/decode_address_response.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DecodeAddressResponse", - "type": "object", - "required": [ - "data", - "entity_type", - "hrp", - "network_id", - "network_name" - ], - "properties": { - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that this address exists on. This is derived from the HRP of the Bech32m encoded address.", - "type": "string", - "pattern": "[0-9]+" - }, - "network_name": { - "description": "A string which represents the name of the network that this address exists on. This is derived from the HRP of the Bech32m encoded address.", - "type": "string" - }, - "entity_type": { - "description": "An [`EntityType`] enum representing the type of entity addressed with the passed address. This is derived from the entity byte on the address data.", - "allOf": [ - { - "$ref": "#/definitions/EntityType" - } - ] - }, - "data": { - "description": "A byte array of 27 bytes (54 hex characters) serialized as a hex string which represents the data encoded in the address.", - "type": "string", - "maxLength": 54, - "minLength": 54, - "pattern": "[0-9a-fA-F]+" - }, - "hrp": { - "description": "A string which represents the Bech32m Human Readable Part (HRP) of the passed address string", - "type": "string" - } - }, - "definitions": { - "EntityType": { - "description": "An enum describing the different entity types in the Radix Engine and Scrypto", - "type": "string", - "enum": [ - "FungibleResource", - "NonFungibleResource", - "Package", - "NormalComponent", - "AccountComponent", - "EcdsaSecp256k1VirtualAccountComponent", - "EddsaEd25519VirtualAccountComponent", - "EpochManager", - "Clock", - "Validator", - "IdentityComponent", - "EcdsaSecp256k1VirtualIdentityComponent", - "EddsaEd25519VirtualIdentityComponent", - "AccessControllerComponent" - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/decompile_notarized_transaction_request.json b/schema/out/schema/decompile_notarized_transaction_request.json deleted file mode 100644 index 0f4147b2..00000000 --- a/schema/out/schema/decompile_notarized_transaction_request.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DecompileNotarizedTransactionRequest", - "description": "This function does the opposite of the compile_notarized_transaction_intent function. This function takes in a compiled notarized transaction intent and decompiles it into its signed transaction intent and notary signature.", - "type": "object", - "required": [ - "compiled_notarized_intent", - "instructions_output_kind" - ], - "properties": { - "instructions_output_kind": { - "description": "Defines the output format that we would like the manifest to be in after this request is performed.", - "allOf": [ - { - "$ref": "#/definitions/InstructionKind" - } - ] - }, - "compiled_notarized_intent": { - "description": "A byte array serialized as a hex string which represents the compiled notarized transaction intent to decompile.", - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - }, - "definitions": { - "InstructionKind": { - "description": "An enum which describes the kind of manifest instructions.", - "type": "string", - "enum": [ - "String", - "Parsed" - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/decompile_notarized_transaction_response.json b/schema/out/schema/decompile_notarized_transaction_response.json deleted file mode 100644 index d206c794..00000000 --- a/schema/out/schema/decompile_notarized_transaction_response.json +++ /dev/null @@ -1,5033 +0,0 @@ -{ - "$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", - "signed_intent" - ], - "properties": { - "signed_intent": { - "description": "The signed transaction intent of the transaction.", - "allOf": [ - { - "$ref": "#/definitions/SignedTransactionIntent" - } - ] - }, - "notary_signature": { - "description": "The signature of the notary on the signed transaction intent.", - "allOf": [ - { - "$ref": "#/definitions/Signature" - } - ] - } - }, - "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", - "intent_signatures" - ], - "properties": { - "intent": { - "description": "The intent of the transaction.", - "allOf": [ - { - "$ref": "#/definitions/TransactionIntent" - } - ] - }, - "intent_signatures": { - "description": "A vector of transaction intent signatures.", - "type": "array", - "items": { - "$ref": "#/definitions/SignatureWithPublicKey" - } - } - } - }, - "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", - "manifest" - ], - "properties": { - "header": { - "description": "A transaction header of the transaction metadata.", - "allOf": [ - { - "$ref": "#/definitions/TransactionHeader" - } - ] - }, - "manifest": { - "description": "A transaction manifest of the transaction instructions and blobs.", - "allOf": [ - { - "$ref": "#/definitions/TransactionManifest" - } - ] - } - } - }, - "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", - "end_epoch_exclusive", - "network_id", - "nonce", - "notary_as_signatory", - "notary_public_key", - "start_epoch_inclusive", - "tip_percentage", - "version" - ], - "properties": { - "version": { - "description": "An 8 bit unsigned integer serialized as a string which represents the transaction version. Currently, this value is always 1.", - "type": "string" - }, - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that this transaction is meant for.", - "type": "string" - }, - "start_epoch_inclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the start of the epoch window in which this transaction executes. This value is inclusive.", - "type": "string" - }, - "end_epoch_exclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the end of the epoch window in which this transaction executes. This value is exclusive.", - "type": "string" - }, - "nonce": { - "description": "A 64 bit unsigned integer serialized as a string which represents a random nonce used for this transaction.", - "type": "string" - }, - "notary_public_key": { - "description": "The public key of the entity that will be notarizing this transaction.", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - }, - "notary_as_signatory": { - "description": "When `true` the notary's signature is also treated as an intent signature and therefore a virtual badge of the signature is added to the auth zone when the transaction auth zone at the beginning of the transaction.", - "type": "boolean" - }, - "cost_unit_limit": { - "description": "A 32 bit unsigned integer serialized as a string which represents the limit or maximum amount of cost units that the transaction is allowed to use.", - "type": "string" - }, - "tip_percentage": { - "description": "A 16 bit unsigned integer serialized as a string which represents the percentage of tips given to validators for this transaction.", - "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]+" - } - } - } - ] - }, - "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]+" - }, - "SignatureWithPublicKey": { - "description": "A discriminated union of the possible pairs of signatures and public keys used by Scrypto and the Radix Engine.", - "oneOf": [ - { - "description": "Cryptographic signature and public key for Ecdsa Secp256k1", - "examples": [ - { - "curve": "EcdsaSecp256k1", - "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" - } - ], - "type": "object", - "required": [ - "curve", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EcdsaSecp256k1" - ] - }, - "signature": { - "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. In this case, only a signature is needed since the public key can be derived from the signature if the message is available.", - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Cryptographic signature and public key for EdDSA Ed25519", - "examples": [ - { - "curve": "EddsaEd25519", - "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" - } - ], - "type": "object", - "required": [ - "curve", - "public_key", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EddsaEd25519" - ] - }, - "public_key": { - "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": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - }, - "signature": { - "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": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - } - ] - }, - "Signature": { - "description": "A discriminated union of the possible cryptographic signatures used by Scrypto and the Radix Engine.", - "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", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EcdsaSecp256k1" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "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.", - "examples": [ - { - "curve": "EddsaEd25519", - "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" - } - ], - "type": "object", - "required": [ - "curve", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EddsaEd25519" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - } - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/decompile_signed_transaction_intent_request.json b/schema/out/schema/decompile_signed_transaction_intent_request.json deleted file mode 100644 index c088ffe4..00000000 --- a/schema/out/schema/decompile_signed_transaction_intent_request.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DecompileSignedTransactionIntentRequest", - "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.", - "type": "object", - "required": [ - "compiled_signed_intent", - "instructions_output_kind" - ], - "properties": { - "instructions_output_kind": { - "description": "Defines the output format that we would like the manifest to be in after this request is performed.", - "allOf": [ - { - "$ref": "#/definitions/InstructionKind" - } - ] - }, - "compiled_signed_intent": { - "description": "A byte array serialized as a hex string which represents the compiled signed transaction intent to decompile.", - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - }, - "definitions": { - "InstructionKind": { - "description": "An enum which describes the kind of manifest instructions.", - "type": "string", - "enum": [ - "String", - "Parsed" - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/decompile_signed_transaction_intent_response.json b/schema/out/schema/decompile_signed_transaction_intent_response.json deleted file mode 100644 index 1d9dd1a0..00000000 --- a/schema/out/schema/decompile_signed_transaction_intent_response.json +++ /dev/null @@ -1,4871 +0,0 @@ -{ - "$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", - "intent_signatures" - ], - "properties": { - "intent": { - "description": "The intent of the transaction.", - "allOf": [ - { - "$ref": "#/definitions/TransactionIntent" - } - ] - }, - "intent_signatures": { - "description": "A vector of transaction intent signatures.", - "type": "array", - "items": { - "$ref": "#/definitions/SignatureWithPublicKey" - } - } - }, - "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", - "manifest" - ], - "properties": { - "header": { - "description": "A transaction header of the transaction metadata.", - "allOf": [ - { - "$ref": "#/definitions/TransactionHeader" - } - ] - }, - "manifest": { - "description": "A transaction manifest of the transaction instructions and blobs.", - "allOf": [ - { - "$ref": "#/definitions/TransactionManifest" - } - ] - } - } - }, - "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", - "end_epoch_exclusive", - "network_id", - "nonce", - "notary_as_signatory", - "notary_public_key", - "start_epoch_inclusive", - "tip_percentage", - "version" - ], - "properties": { - "version": { - "description": "An 8 bit unsigned integer serialized as a string which represents the transaction version. Currently, this value is always 1.", - "type": "string" - }, - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that this transaction is meant for.", - "type": "string" - }, - "start_epoch_inclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the start of the epoch window in which this transaction executes. This value is inclusive.", - "type": "string" - }, - "end_epoch_exclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the end of the epoch window in which this transaction executes. This value is exclusive.", - "type": "string" - }, - "nonce": { - "description": "A 64 bit unsigned integer serialized as a string which represents a random nonce used for this transaction.", - "type": "string" - }, - "notary_public_key": { - "description": "The public key of the entity that will be notarizing this transaction.", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - }, - "notary_as_signatory": { - "description": "When `true` the notary's signature is also treated as an intent signature and therefore a virtual badge of the signature is added to the auth zone when the transaction auth zone at the beginning of the transaction.", - "type": "boolean" - }, - "cost_unit_limit": { - "description": "A 32 bit unsigned integer serialized as a string which represents the limit or maximum amount of cost units that the transaction is allowed to use.", - "type": "string" - }, - "tip_percentage": { - "description": "A 16 bit unsigned integer serialized as a string which represents the percentage of tips given to validators for this transaction.", - "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]+" - } - } - } - ] - }, - "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]+" - }, - "SignatureWithPublicKey": { - "description": "A discriminated union of the possible pairs of signatures and public keys used by Scrypto and the Radix Engine.", - "oneOf": [ - { - "description": "Cryptographic signature and public key for Ecdsa Secp256k1", - "examples": [ - { - "curve": "EcdsaSecp256k1", - "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" - } - ], - "type": "object", - "required": [ - "curve", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EcdsaSecp256k1" - ] - }, - "signature": { - "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. In this case, only a signature is needed since the public key can be derived from the signature if the message is available.", - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Cryptographic signature and public key for EdDSA Ed25519", - "examples": [ - { - "curve": "EddsaEd25519", - "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" - } - ], - "type": "object", - "required": [ - "curve", - "public_key", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EddsaEd25519" - ] - }, - "public_key": { - "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": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - }, - "signature": { - "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": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - } - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/decompile_transaction_intent_request.json b/schema/out/schema/decompile_transaction_intent_request.json deleted file mode 100644 index a5fc67de..00000000 --- a/schema/out/schema/decompile_transaction_intent_request.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DecompileTransactionIntentRequest", - "description": "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.", - "type": "object", - "required": [ - "compiled_intent", - "instructions_output_kind" - ], - "properties": { - "instructions_output_kind": { - "description": "Defines the output format that we would like the manifest to be in after this request is performed.", - "allOf": [ - { - "$ref": "#/definitions/InstructionKind" - } - ] - }, - "compiled_intent": { - "description": "A byte array serialized as a hex string which represents the compiled transaction intent to decompile.", - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - }, - "definitions": { - "InstructionKind": { - "description": "An enum which describes the kind of manifest instructions.", - "type": "string", - "enum": [ - "String", - "Parsed" - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/decompile_transaction_intent_response.json b/schema/out/schema/decompile_transaction_intent_response.json deleted file mode 100644 index 39f0083a..00000000 --- a/schema/out/schema/decompile_transaction_intent_response.json +++ /dev/null @@ -1,4705 +0,0 @@ -{ - "$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", - "manifest" - ], - "properties": { - "header": { - "description": "A transaction header of the transaction metadata.", - "allOf": [ - { - "$ref": "#/definitions/TransactionHeader" - } - ] - }, - "manifest": { - "description": "A transaction manifest of the transaction instructions and blobs.", - "allOf": [ - { - "$ref": "#/definitions/TransactionManifest" - } - ] - } - }, - "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", - "end_epoch_exclusive", - "network_id", - "nonce", - "notary_as_signatory", - "notary_public_key", - "start_epoch_inclusive", - "tip_percentage", - "version" - ], - "properties": { - "version": { - "description": "An 8 bit unsigned integer serialized as a string which represents the transaction version. Currently, this value is always 1.", - "type": "string" - }, - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that this transaction is meant for.", - "type": "string" - }, - "start_epoch_inclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the start of the epoch window in which this transaction executes. This value is inclusive.", - "type": "string" - }, - "end_epoch_exclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the end of the epoch window in which this transaction executes. This value is exclusive.", - "type": "string" - }, - "nonce": { - "description": "A 64 bit unsigned integer serialized as a string which represents a random nonce used for this transaction.", - "type": "string" - }, - "notary_public_key": { - "description": "The public key of the entity that will be notarizing this transaction.", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - }, - "notary_as_signatory": { - "description": "When `true` the notary's signature is also treated as an intent signature and therefore a virtual badge of the signature is added to the auth zone when the transaction auth zone at the beginning of the transaction.", - "type": "boolean" - }, - "cost_unit_limit": { - "description": "A 32 bit unsigned integer serialized as a string which represents the limit or maximum amount of cost units that the transaction is allowed to use.", - "type": "string" - }, - "tip_percentage": { - "description": "A 16 bit unsigned integer serialized as a string which represents the percentage of tips given to validators for this transaction.", - "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]+" - } - } - } - ] - }, - "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/decompile_unknown_transaction_intent_request.json b/schema/out/schema/decompile_unknown_transaction_intent_request.json deleted file mode 100644 index 6fab62f3..00000000 --- a/schema/out/schema/decompile_unknown_transaction_intent_request.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DecompileUnknownTransactionIntentRequest", - "description": "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.", - "type": "object", - "required": [ - "compiled_unknown_intent", - "instructions_output_kind" - ], - "properties": { - "instructions_output_kind": { - "description": "Defines the output format that we would like the manifest to be in after this request is performed.", - "allOf": [ - { - "$ref": "#/definitions/InstructionKind" - } - ] - }, - "compiled_unknown_intent": { - "description": "A byte array serialized as a hex string which represents what is suspected to be a compiled intent of an unknown kind.", - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - }, - "definitions": { - "InstructionKind": { - "description": "An enum which describes the kind of manifest instructions.", - "type": "string", - "enum": [ - "String", - "Parsed" - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/decompile_unknown_transaction_intent_response.json b/schema/out/schema/decompile_unknown_transaction_intent_response.json deleted file mode 100644 index b982e1e9..00000000 --- a/schema/out/schema/decompile_unknown_transaction_intent_response.json +++ /dev/null @@ -1,5237 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DecompileUnknownTransactionIntentResponse", - "description": "The response from [`DecompileUnknownTransactionIntentRequest`]. This is an tagged union which can either be a [`DecompileTransactionIntentResponse`], [`DecompileSignedTransactionIntentResponse`], or [`DecompileNotarizedTransactionResponse`] depending on the passed intent.", - "oneOf": [ - { - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "TransactionIntent" - ] - }, - "value": { - "$ref": "#/definitions/DecompileTransactionIntentResponse" - } - } - }, - { - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "SignedTransactionIntent" - ] - }, - "value": { - "$ref": "#/definitions/DecompileSignedTransactionIntentResponse" - } - } - }, - { - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "NotarizedTransactionIntent" - ] - }, - "value": { - "$ref": "#/definitions/DecompileNotarizedTransactionResponse" - } - } - } - ], - "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", - "manifest" - ], - "properties": { - "header": { - "description": "A transaction header of the transaction metadata.", - "allOf": [ - { - "$ref": "#/definitions/TransactionHeader" - } - ] - }, - "manifest": { - "description": "A transaction manifest of the transaction instructions and blobs.", - "allOf": [ - { - "$ref": "#/definitions/TransactionManifest" - } - ] - } - } - }, - "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", - "end_epoch_exclusive", - "network_id", - "nonce", - "notary_as_signatory", - "notary_public_key", - "start_epoch_inclusive", - "tip_percentage", - "version" - ], - "properties": { - "version": { - "description": "An 8 bit unsigned integer serialized as a string which represents the transaction version. Currently, this value is always 1.", - "type": "string" - }, - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that this transaction is meant for.", - "type": "string" - }, - "start_epoch_inclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the start of the epoch window in which this transaction executes. This value is inclusive.", - "type": "string" - }, - "end_epoch_exclusive": { - "description": "A 64 bit unsigned integer serialized as a string which represents the end of the epoch window in which this transaction executes. This value is exclusive.", - "type": "string" - }, - "nonce": { - "description": "A 64 bit unsigned integer serialized as a string which represents a random nonce used for this transaction.", - "type": "string" - }, - "notary_public_key": { - "description": "The public key of the entity that will be notarizing this transaction.", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - }, - "notary_as_signatory": { - "description": "When `true` the notary's signature is also treated as an intent signature and therefore a virtual badge of the signature is added to the auth zone when the transaction auth zone at the beginning of the transaction.", - "type": "boolean" - }, - "cost_unit_limit": { - "description": "A 32 bit unsigned integer serialized as a string which represents the limit or maximum amount of cost units that the transaction is allowed to use.", - "type": "string" - }, - "tip_percentage": { - "description": "A 16 bit unsigned integer serialized as a string which represents the percentage of tips given to validators for this transaction.", - "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]+" - } - } - } - ] - }, - "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]+" - }, - "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", - "intent_signatures" - ], - "properties": { - "intent": { - "description": "The intent of the transaction.", - "allOf": [ - { - "$ref": "#/definitions/TransactionIntent" - } - ] - }, - "intent_signatures": { - "description": "A vector of transaction intent signatures.", - "type": "array", - "items": { - "$ref": "#/definitions/SignatureWithPublicKey" - } - } - } - }, - "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", - "manifest" - ], - "properties": { - "header": { - "description": "A transaction header of the transaction metadata.", - "allOf": [ - { - "$ref": "#/definitions/TransactionHeader" - } - ] - }, - "manifest": { - "description": "A transaction manifest of the transaction instructions and blobs.", - "allOf": [ - { - "$ref": "#/definitions/TransactionManifest" - } - ] - } - } - }, - "SignatureWithPublicKey": { - "description": "A discriminated union of the possible pairs of signatures and public keys used by Scrypto and the Radix Engine.", - "oneOf": [ - { - "description": "Cryptographic signature and public key for Ecdsa Secp256k1", - "examples": [ - { - "curve": "EcdsaSecp256k1", - "signature": "007f054d0a376fb5cce93c5836531ce5d116dcdb134211650553ddeba408e53b4725b8fe89d120c41667fe457acae408025371a61b8fe05b20d2c2b9e8d81f1a53" - } - ], - "type": "object", - "required": [ - "curve", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EcdsaSecp256k1" - ] - }, - "signature": { - "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. In this case, only a signature is needed since the public key can be derived from the signature if the message is available.", - "type": "string", - "maxLength": 130, - "minLength": 130, - "pattern": "[0-9a-fA-F]+" - } - } - }, - { - "description": "Cryptographic signature and public key for EdDSA Ed25519", - "examples": [ - { - "curve": "EddsaEd25519", - "public_key": "4cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba29", - "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" - } - ], - "type": "object", - "required": [ - "curve", - "public_key", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EddsaEd25519" - ] - }, - "public_key": { - "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": "string", - "maxLength": 66, - "minLength": 66, - "pattern": "[0-9a-fA-F]+" - }, - "signature": { - "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": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - } - ] - }, - "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", - "signed_intent" - ], - "properties": { - "signed_intent": { - "description": "The signed transaction intent of the transaction.", - "allOf": [ - { - "$ref": "#/definitions/SignedTransactionIntent" - } - ] - }, - "notary_signature": { - "description": "The signature of the notary on the signed transaction intent.", - "allOf": [ - { - "$ref": "#/definitions/Signature" - } - ] - } - } - }, - "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", - "intent_signatures" - ], - "properties": { - "intent": { - "description": "The intent of the transaction.", - "allOf": [ - { - "$ref": "#/definitions/TransactionIntent" - } - ] - }, - "intent_signatures": { - "description": "A vector of transaction intent signatures.", - "type": "array", - "items": { - "$ref": "#/definitions/SignatureWithPublicKey" - } - } - } - }, - "Signature": { - "description": "A discriminated union of the possible cryptographic signatures used by Scrypto and the Radix Engine.", - "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", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EcdsaSecp256k1" - ] - }, - "signature": { - "type": "string", - "maxLength": 130, - "minLength": 130, - "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.", - "examples": [ - { - "curve": "EddsaEd25519", - "signature": "e5f1e508cc91a95a280613618a1ccb5142744b5b8a6042e232dcaadf17e41f1f0131d535ea3fa56b6ae8164586cd6b4e89e3224e994b3109ca51cae02e7dce01" - } - ], - "type": "object", - "required": [ - "curve", - "signature" - ], - "properties": { - "curve": { - "type": "string", - "enum": [ - "EddsaEd25519" - ] - }, - "signature": { - "type": "string", - "maxLength": 128, - "minLength": 128, - "pattern": "[0-9a-fA-F]+" - } - } - } - ] - } - } -} \ No newline at end of file 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 deleted file mode 100644 index b923998d..00000000 --- a/schema/out/schema/derive_babylon_address_from_olympia_address_request.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "$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 deleted file mode 100644 index 2f836a5b..00000000 --- a/schema/out/schema/derive_babylon_address_from_olympia_address_response.json +++ /dev/null @@ -1,171 +0,0 @@ -{ - "$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 deleted file mode 100644 index 6f2e020c..00000000 --- a/schema/out/schema/derive_non_fungible_global_id_from_public_key_request.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DeriveNonFungibleGlobalIdFromPublicKeyRequest", - "description": "This function derives the non-fungible global id of the virtual badge associated with the passed public key.", - "type": "object", - "required": [ - "network_id", - "public_key" - ], - "properties": { - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that the virtual badge non-fungible global id is being derived for.", - "type": "string" - }, - "public_key": { - "description": "The public key to derive the non-fungible global id for.", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - } - }, - "definitions": { - "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_response.json b/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json deleted file mode 100644 index e512505e..00000000 --- a/schema/out/schema/derive_non_fungible_global_id_from_public_key_response.json +++ /dev/null @@ -1,271 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DeriveNonFungibleGlobalIdFromPublicKeyResponse", - "description": "The response from [`DeriveNonFungibleGlobalIdFromPublicKeyRequest`].", - "type": "object", - "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": [ - { - "$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": [ - { - "non_fungible_local_id": { - "type": "Integer", - "value": "1" - }, - "resource_address": { - "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", - "type": "ResourceAddress" - } - }, - { - "non_fungible_local_id": { - "type": "String", - "value": "Scrypto" - }, - "resource_address": { - "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", - "type": "ResourceAddress" - } - }, - { - "non_fungible_local_id": { - "type": "Bytes", - "value": "01020304" - }, - "resource_address": { - "address": "resource_rdx1qgqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqfkl4uk", - "type": "ResourceAddress" - } - }, - { - "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" - }, - "non_fungible_local_id": { - "$ref": "#/definitions/NonFungibleLocalId" - } - } - }, - "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" - } - } - } - ] - }, - "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 - } - } - } - ] - } - } -} \ 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 deleted file mode 100644 index 666a478f..00000000 --- a/schema/out/schema/derive_virtual_account_address_request.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DeriveVirtualAccountAddressRequest", - "description": "Derives the virtual account component address given a public key and a network id.", - "type": "object", - "required": [ - "network_id", - "public_key" - ], - "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]+" - }, - "public_key": { - "description": "The public key to derive the virtual account address for", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - } - }, - "definitions": { - "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_virtual_account_address_response.json b/schema/out/schema/derive_virtual_account_address_response.json deleted file mode 100644 index 8844da93..00000000 --- a/schema/out/schema/derive_virtual_account_address_response.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DeriveVirtualAccountAddressResponse", - "description": "The response form [`DeriveVirtualAccountAddressRequest`] requests", - "type": "object", - "required": [ - "virtual_account_address" - ], - "properties": { - "virtual_account_address": { - "description": "The virtual account component address serialized as a `ComponentAddress` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/EntityAddress" - } - ] - } - }, - "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" - } - } - } - ] - } - } -} \ 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 deleted file mode 100644 index a97ed090..00000000 --- a/schema/out/schema/derive_virtual_identity_address_request.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DeriveVirtualIdentityAddressRequest", - "description": "Derives the virtual identity component address given a public key and a network id.", - "type": "object", - "required": [ - "network_id", - "public_key" - ], - "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]+" - }, - "public_key": { - "description": "The public key to derive the virtual identity address for", - "allOf": [ - { - "$ref": "#/definitions/PublicKey" - } - ] - } - }, - "definitions": { - "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_virtual_identity_address_response.json b/schema/out/schema/derive_virtual_identity_address_response.json deleted file mode 100644 index 57fe3461..00000000 --- a/schema/out/schema/derive_virtual_identity_address_response.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "DeriveVirtualIdentityAddressResponse", - "description": "The response form [`DeriveVirtualIdentityAddressRequest`] requests", - "type": "object", - "required": [ - "virtual_identity_address" - ], - "properties": { - "virtual_identity_address": { - "description": "The virtual identity component address serialized as a `ComponentAddress` from the `Value` model.", - "allOf": [ - { - "$ref": "#/definitions/EntityAddress" - } - ] - } - }, - "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" - } - } - } - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/encode_address_request.json b/schema/out/schema/encode_address_request.json deleted file mode 100644 index 21211e9c..00000000 --- a/schema/out/schema/encode_address_request.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "EncodeAddressRequest", - "description": "This request 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.", - "type": "object", - "required": [ - "address_bytes", - "network_id" - ], - "properties": { - "address_bytes": { - "description": "A byte array of 27 bytes (54 hex characters) serialized as a hex string of the data part of the address.", - "type": "string", - "maxLength": 54, - "minLength": 54, - "pattern": "[0-9a-fA-F]+" - }, - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that this address exists on.", - "type": "string", - "pattern": "[0-9]+" - } - } -} \ No newline at end of file diff --git a/schema/out/schema/encode_address_response.json b/schema/out/schema/encode_address_response.json deleted file mode 100644 index 6eb84cc2..00000000 --- a/schema/out/schema/encode_address_response.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "EncodeAddressResponse", - "description": "The response from [`EncodeAddressRequest`].", - "type": "object", - "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" - } - } - } - ] -} \ No newline at end of file diff --git a/schema/out/schema/hash_request.json b/schema/out/schema/hash_request.json deleted file mode 100644 index dc481645..00000000 --- a/schema/out/schema/hash_request.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$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 deleted file mode 100644 index 7a22c0af..00000000 --- a/schema/out/schema/hash_response.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$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_request.json b/schema/out/schema/information_request.json deleted file mode 100644 index 50e96273..00000000 --- a/schema/out/schema/information_request.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "InformationRequest", - "description": "The request 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.", - "type": "object" -} \ No newline at end of file diff --git a/schema/out/schema/information_response.json b/schema/out/schema/information_response.json deleted file mode 100644 index 9332afda..00000000 --- a/schema/out/schema/information_response.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "InformationResponse", - "description": "The response from [`InformationRequest`]s", - "type": "object", - "required": [ - "last_commit_hash", - "package_version" - ], - "properties": { - "package_version": { - "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" - }, - "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" - } - } -} \ No newline at end of file diff --git a/schema/out/schema/known_entity_addresses_request.json b/schema/out/schema/known_entity_addresses_request.json deleted file mode 100644 index 633368de..00000000 --- a/schema/out/schema/known_entity_addresses_request.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "KnownEntityAddressesRequest", - "description": "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).", - "type": "object", - "required": [ - "network_id" - ], - "properties": { - "network_id": { - "description": "An unsigned 8 bit integer serialized as a string which represents the ID of the network that the addresses will be used on. The primary use of this is for any Bech32m encoding or decoding of addresses", - "type": "string", - "pattern": "[0-9]+" - } - } -} \ No newline at end of file diff --git a/schema/out/schema/known_entity_addresses_response.json b/schema/out/schema/known_entity_addresses_response.json deleted file mode 100644 index bcae73e3..00000000 --- a/schema/out/schema/known_entity_addresses_response.json +++ /dev/null @@ -1,182 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "KnownEntityAddressesResponse", - "description": "The response from [`KnownEntityAddressesRequest`] requests", - "type": "object", - "required": [ - "account_package_address", - "clock_system_address", - "ecdsa_secp256k1_token_resource_address", - "eddsa_ed25519_token_resource_address", - "epoch_manager_system_address", - "faucet_component_address", - "faucet_package_address", - "package_token_resource_address", - "system_token_resource_address", - "xrd_resource_address" - ], - "properties": { - "faucet_component_address": { - "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/EntityAddress" - } - ] - }, - "faucet_package_address": { - "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/EntityAddress" - } - ] - }, - "account_package_address": { - "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/EntityAddress" - } - ] - }, - "xrd_resource_address": { - "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/EntityAddress" - } - ] - }, - "system_token_resource_address": { - "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/EntityAddress" - } - ] - }, - "ecdsa_secp256k1_token_resource_address": { - "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/EntityAddress" - } - ] - }, - "eddsa_ed25519_token_resource_address": { - "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/EntityAddress" - } - ] - }, - "package_token_resource_address": { - "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/EntityAddress" - } - ] - }, - "epoch_manager_system_address": { - "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/EntityAddress" - } - ] - }, - "clock_system_address": { - "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/EntityAddress" - } - ] - } - }, - "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" - } - } - } - ] - } - } -} \ No newline at end of file diff --git a/schema/out/schema/sbor_decode_request.json b/schema/out/schema/sbor_decode_request.json deleted file mode 100644 index 22c7b5d5..00000000 --- a/schema/out/schema/sbor_decode_request.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "SborDecodeRequest", - "description": "Takes in a byte array of SBOR byte and attempts to decode it to a [`Value`]. Since some of the types in the [`Value`] model are network aware, this request also takes in a network id which is primarily used for the Bech32m encoding of addresses.", - "type": "object", - "required": [ - "encoded_value", - "network_id" - ], - "properties": { - "encoded_value": { - "description": "A byte array serialized as a hex string of the SBOR buffer to attempt to decode as a [`Value`]", - "type": "string", - "pattern": "[0-9a-fA-F]+" - }, - "network_id": { - "description": "An 8 bit unsigned integer serialized as a string which represents the id of the network that the decoded data will be used on. This is primarily used for the Bech32m encoding of addresses.", - "type": "string", - "pattern": "[0-9]+" - } - } -} \ No newline at end of file diff --git a/schema/out/schema/sbor_decode_response.json b/schema/out/schema/sbor_decode_response.json deleted file mode 100644 index 5f50f07f..00000000 --- a/schema/out/schema/sbor_decode_response.json +++ /dev/null @@ -1,2649 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "SborDecodeResponse", - "description": "The response from the [`SborDecodeRequest`].", - "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": { - "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" - } - } - }, - { - "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": "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]+" - } - } - }, - { - "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 reference to some RENode.", - "examples": [ - { - "type": "Reference", - "value": "00000000000000000000000000000000000000000000000000000000000000" - } - ], - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Reference" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - } - ] - }, - "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": [ - "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": "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": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Object", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Object" - ] - }, - "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", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "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" - } - } - } - ] - }, - "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 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 - } - } - } - ] - }, - "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": [ - "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": "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/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" - ] - } - ] - }, - "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_encode_request.json b/schema/out/schema/sbor_encode_request.json deleted file mode 100644 index 3487fb00..00000000 --- a/schema/out/schema/sbor_encode_request.json +++ /dev/null @@ -1,2649 +0,0 @@ -{ - "$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.", - "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": { - "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" - } - } - }, - { - "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": "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]+" - } - } - }, - { - "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 reference to some RENode.", - "examples": [ - { - "type": "Reference", - "value": "00000000000000000000000000000000000000000000000000000000000000" - } - ], - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Reference" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - } - ] - }, - "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": [ - "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": "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": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "KeyValueStore" - ] - }, - "value": { - "$ref": "#/definitions/NodeIdentifier" - } - } - }, - { - "description": "Represents an owned Object", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "Object" - ] - }, - "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", - "type": "object", - "required": [ - "type", - "value" - ], - "properties": { - "type": { - "type": "string", - "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" - } - } - } - ] - }, - "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 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 - } - } - } - ] - }, - "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": [ - "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": "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/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" - ] - } - ] - }, - "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_encode_response.json b/schema/out/schema/sbor_encode_response.json deleted file mode 100644 index e9298d20..00000000 --- a/schema/out/schema/sbor_encode_response.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "SborEncodeResponse", - "description": "The response from the [`SborEncodeRequest`].", - "type": "object", - "required": [ - "encoded_value" - ], - "properties": { - "encoded_value": { - "description": "A byte array serialized as a hex string of the SBOR encoded value.", - "type": "string", - "pattern": "[0-9a-fA-F]+" - } - } -} \ No newline at end of file diff --git a/schema/out/schema/statically_validate_transaction_request.json b/schema/out/schema/statically_validate_transaction_request.json deleted file mode 100644 index e5235fba..00000000 --- a/schema/out/schema/statically_validate_transaction_request.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "StaticallyValidateTransactionRequest", - "description": "Performs static validation on the given notarized transaction. This request checks that: the header is valid by ensuring that all elements of the header are valid, that the signatures are valid, and that the manifest is valid.", - "type": "object", - "required": [ - "compiled_notarized_intent", - "validation_config" - ], - "properties": { - "compiled_notarized_intent": { - "description": "A byte array serialized as a hex string which represents the compiled notarized intent to perform static validation on.", - "type": "string", - "pattern": "[0-9a-fA-F]+" - }, - "validation_config": { - "description": "The validation configuration which is the parameters and limits to use for the static validation", - "allOf": [ - { - "$ref": "#/definitions/ValidationConfig" - } - ] - } - }, - "definitions": { - "ValidationConfig": { - "description": "Represents a set of settings to use when statically validating a notarized transaction intent.", - "type": "object", - "required": [ - "max_cost_unit_limit", - "max_epoch_range", - "max_tip_percentage", - "min_cost_unit_limit", - "min_tip_percentage", - "network_id" - ], - "properties": { - "network_id": { - "description": "An unsigned 8 bit integer serialized as a string which represents the network id to validate the transaction against.", - "type": "string", - "pattern": "[0-9]+" - }, - "min_cost_unit_limit": { - "description": "An unsigned 32 bit integer serialized as a string which represents the minimum cost unit limit that a transaction is allowed to have.", - "type": "string", - "pattern": "[0-9]+" - }, - "max_cost_unit_limit": { - "description": "An unsigned 32 bit integer serialized as a string which represents the maximum cost unit limit that a transaction is allowed to have.", - "type": "string", - "pattern": "[0-9]+" - }, - "min_tip_percentage": { - "description": "An unsigned 16 bit integer serialized as a string which represents the minimum tip percentage that a transaction is allowed to have.", - "type": "string", - "pattern": "[0-9]+" - }, - "max_tip_percentage": { - "description": "An unsigned 16 bit integer serialized as a string which represents the maximum tip percentage that a transaction is allowed to have.", - "type": "string", - "pattern": "[0-9]+" - }, - "max_epoch_range": { - "description": "An unsigned 64 bit integer serialized as a string which represents the maximum difference that can exist between the start and end epoch of transactions.", - "type": "string", - "pattern": "[0-9]+" - } - } - } - } -} \ No newline at end of file diff --git a/schema/out/schema/statically_validate_transaction_response.json b/schema/out/schema/statically_validate_transaction_response.json deleted file mode 100644 index 158155dc..00000000 --- a/schema/out/schema/statically_validate_transaction_response.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "StaticallyValidateTransactionResponse", - "description": "The response from [`StaticallyValidateTransactionRequest`].", - "oneOf": [ - { - "type": "object", - "required": [ - "validity" - ], - "properties": { - "validity": { - "type": "string", - "enum": [ - "Valid" - ] - } - } - }, - { - "type": "object", - "required": [ - "error", - "validity" - ], - "properties": { - "validity": { - "type": "string", - "enum": [ - "Invalid" - ] - }, - "error": { - "type": "string" - } - } - } - ] -} \ No newline at end of file diff --git a/schema/src/examples.rs b/schema/src/examples.rs deleted file mode 100644 index f4f486cf..00000000 --- a/schema/src/examples.rs +++ /dev/null @@ -1,572 +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 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 scrypto::network::NetworkDefinition; -use scrypto::prelude::manifest_encode; - -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() -} - -pub fn notarized_intent() -> NotarizedTransaction { - TransactionBuilder::new() - .manifest( - compile( - include_str!( - "../../radix-engine-toolkit/tests/test_vector/manifest/resources/worktop.rtm" - ), - &network_definition(), - vec![], - ) - .unwrap(), - ) - .header(TransactionHeader { - version: 0x01, - network_id: network_definition().id, - cost_unit_limit: 100_000_000, - start_epoch_inclusive: 0x200, - end_epoch_exclusive: 0x210, - nonce: 0x22, - notary_as_signatory: true, - notary_public_key: notary_private_key().public_key().into(), - tip_percentage: 0x00, - }) - .sign(&EcdsaSecp256k1PrivateKey::from_u64(1).unwrap()) - .sign(&EcdsaSecp256k1PrivateKey::from_u64(2).unwrap()) - .sign(&EcdsaSecp256k1PrivateKey::from_u64(3).unwrap()) - .sign(&EddsaEd25519PrivateKey::from_u64(1).unwrap()) - .sign(&EddsaEd25519PrivateKey::from_u64(2).unwrap()) - .sign(&EddsaEd25519PrivateKey::from_u64(3).unwrap()) - .notarize(¬ary_private_key()) - .build() -} - -pub fn notary_private_key() -> EcdsaSecp256k1PrivateKey { - EcdsaSecp256k1PrivateKey::from_u64(1923112).unwrap() -} - -pub fn value() -> ScryptoSborValue { - ScryptoSborValue::Tuple { - elements: vec![ - ScryptoSborValue::Decimal { value: dec!("10") }, - ScryptoSborValue::PreciseDecimal { value: pdec!("10") }, - ScryptoSborValue::String { - value: "Hello World!".into(), - }, - ScryptoSborValue::Tuple { - elements: vec![ - ScryptoSborValue::Decimal { value: dec!("10") }, - ScryptoSborValue::PreciseDecimal { value: pdec!("10") }, - ScryptoSborValue::String { - value: "Hello World!".into(), - }, - ScryptoSborValue::Tuple { - elements: vec![ - ScryptoSborValue::Decimal { value: dec!("10") }, - ScryptoSborValue::PreciseDecimal { value: pdec!("10") }, - ScryptoSborValue::String { - value: "Hello World!".into(), - }, - ScryptoSborValue::Tuple { - elements: vec![ - ScryptoSborValue::Decimal { value: dec!("10") }, - ScryptoSborValue::PreciseDecimal { value: pdec!("10") }, - ScryptoSborValue::String { - value: "Hello World!".into(), - }, - ScryptoSborValue::Array { - element_kind: ScryptoSborValueKind::Decimal, - elements: vec![ - ScryptoSborValue::Decimal { value: dec!("20") }, - ScryptoSborValue::Decimal { value: dec!("100") }, - ScryptoSborValue::Decimal { - value: dec!("192.31"), - }, - ], - }, - ], - }, - ], - }, - ], - }, - ], - } -} - -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, -} - -pub trait ExampleData -where - Self: Handler, - I: Serialize + Clone + Debug, - O: Serialize + Clone + Debug, -{ - fn description() -> String; - - fn example_request() -> I; - - fn example_response() -> O { - Self::fulfill(Self::example_request()) - .expect(format!("Failed. Request: {:?}", Self::example_request()).as_str()) - } - - fn request_type_name() -> String { - std::any::type_name::() - .split("::") - .last() - .unwrap() - .to_owned() - } - fn response_type_name() -> String { - std::any::type_name::() - .split("::") - .last() - .unwrap() - .to_owned() - } - - fn required_features() -> String { - "default".into() - } - - fn to_example() -> Example { - let request = Self::example_request(); - let response = Self::example_response(); - Example { - 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(), - } - } -} - -impl ExampleData for InformationHandler { - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> InformationRequest { - InformationRequest {} - } - - fn example_response() -> InformationResponse { - let mut response = Self::fulfill(Self::example_request()).unwrap(); - response.last_commit_hash = - "This is just an example. We don't have a commit hash here".into(); - response - } -} - -impl ExampleData for ConvertManifestHandler { - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> ConvertManifestRequest { - let bec32_coder = Bech32Coder::new(network_definition().id); - ConvertManifestRequest { - 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, - } - } -} - -impl ExampleData for AnalyzeManifestHandler { - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> AnalyzeManifestRequest { - let bec32_coder = Bech32Coder::new(network_definition().id); - AnalyzeManifestRequest { - 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, - } - } -} - -impl ExampleData - for CompileTransactionIntentHandler -{ - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> CompileTransactionIntentRequest { - CompileTransactionIntentRequest { - transaction_intent: - radix_engine_toolkit::model::transaction::TransactionIntent::from_native_transaction_intent( - ¬arized_intent().signed_intent.intent, - InstructionKind::Parsed, - ) - .unwrap(), - } - } -} - -impl ExampleData - for DecompileTransactionIntentHandler -{ - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> DecompileTransactionIntentRequest { - let compiled_transaction_intent = - manifest_encode(¬arized_intent().signed_intent.intent).unwrap(); - DecompileTransactionIntentRequest { - compiled_intent: compiled_transaction_intent, - instructions_output_kind: - radix_engine_toolkit::model::transaction::InstructionKind::Parsed, - } - } -} - -impl ExampleData - for CompileSignedTransactionIntentHandler -{ - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> CompileSignedTransactionIntentRequest { - CompileSignedTransactionIntentRequest { - signed_intent: radix_engine_toolkit::model::transaction::SignedTransactionIntent::from_native_signed_transaction_intent(¬arized_intent() - .signed_intent - , InstructionKind::Parsed) - .unwrap(), - } - } -} - -impl ExampleData - for DecompileSignedTransactionIntentHandler -{ - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> DecompileSignedTransactionIntentRequest { - let compiled_transaction_intent = - manifest_encode(¬arized_intent().signed_intent).unwrap(); - DecompileSignedTransactionIntentRequest { - compiled_signed_intent: compiled_transaction_intent, - instructions_output_kind: - radix_engine_toolkit::model::transaction::InstructionKind::Parsed, - } - } -} - -impl ExampleData - for CompileNotarizedTransactionHandler -{ - fn description() -> String { - r#"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"#.to_owned() - } - - fn example_request() -> CompileNotarizedTransactionRequest { - CompileNotarizedTransactionRequest { - notarized_intent: radix_engine_toolkit::model::transaction::NotarizedTransaction::from_native_notarized_transaction_intent(¬arized_intent() - , InstructionKind::Parsed) - .unwrap(), - } - } -} - -impl ExampleData - for DecompileNotarizedTransactionHandler -{ - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> DecompileNotarizedTransactionRequest { - let compiled_transaction_intent = manifest_encode(¬arized_intent()).unwrap(); - DecompileNotarizedTransactionRequest { - compiled_notarized_intent: compiled_transaction_intent, - instructions_output_kind: - radix_engine_toolkit::model::transaction::InstructionKind::Parsed, - } - } -} - -impl - ExampleData - for DecompileUnknownTransactionIntentHandler -{ - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> DecompileUnknownTransactionIntentRequest { - let compiled_transaction_intent = manifest_encode(¬arized_intent()).unwrap(); - DecompileUnknownTransactionIntentRequest { - compiled_unknown_intent: compiled_transaction_intent, - instructions_output_kind: - radix_engine_toolkit::model::transaction::InstructionKind::Parsed, - } - } -} - -impl ExampleData for EncodeAddressHandler { - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> EncodeAddressRequest { - EncodeAddressRequest { - address_bytes: vec![ - 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, 2, - ], - network_id: 0xf2, - } - } -} - -impl ExampleData for DecodeAddressHandler { - fn description() -> String { - r#"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."#.to_owned() - } - - fn example_request() -> DecodeAddressRequest { - DecodeAddressRequest { - address: "resource_sim1qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqs6d89k".into(), - } - } -} - -impl ExampleData for SborEncodeHandler { - fn description() -> String { - r#"This function takes in a ScryptoSborValue and encodes it in SBOR."#.to_owned() - } - - fn example_request() -> SborEncodeRequest { - SborEncodeRequest::ScryptoSbor(value()) - } -} - -impl ExampleData for SborDecodeHandler { - fn description() -> String { - 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: 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, - } - } -} - -impl ExampleData - for DeriveVirtualAccountAddressHandler -{ - fn description() -> String { - r#"Derives the virtual account component address given a public key and a network id."# - .to_owned() - } - - fn example_request() -> DeriveVirtualAccountAddressRequest { - DeriveVirtualAccountAddressRequest { - network_id: 0xf2, - public_key: notary_private_key().public_key().into(), - } - } -} - -impl ExampleData - for DeriveVirtualIdentityAddressHandler -{ - fn description() -> String { - r#"Derives the virtual identity component address given a public key and a network id."# - .to_owned() - } - - fn example_request() -> DeriveVirtualIdentityAddressRequest { - DeriveVirtualIdentityAddressRequest { - network_id: 0xf2, - public_key: notary_private_key().public_key().into(), - } - } -} - -impl - ExampleData< - DeriveNonFungibleGlobalIdFromPublicKeyRequest, - DeriveNonFungibleGlobalIdFromPublicKeyResponse, - > for DeriveNonFungibleGlobalIdFromPublicKeyHandler -{ - fn description() -> String { - r#"Derives the non-fungible global id of the virtual badge associated with a given public key"# - .to_owned() - } - - fn example_request() -> DeriveNonFungibleGlobalIdFromPublicKeyRequest { - DeriveNonFungibleGlobalIdFromPublicKeyRequest { - network_id: 0xf2, - public_key: notary_private_key().public_key().into(), - } - } -} - -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 -{ - fn description() -> String { - r#"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)."# - .to_owned() - } - - fn example_request() -> KnownEntityAddressesRequest { - KnownEntityAddressesRequest { network_id: 0x01 } - } -} - -impl ExampleData - for StaticallyValidateTransactionHandler -{ - fn description() -> String { - r#"Performs static validation on the given notarized transaction."#.to_owned() - } - - fn example_request() -> StaticallyValidateTransactionRequest { - // 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(); - let validation_config = native_transaction::validation::ValidationConfig::default(0xf2); - StaticallyValidateTransactionRequest { - compiled_notarized_intent: compiled_transaction_intent, - validation_config, - } - } -} - -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 deleted file mode 100644 index 7f9407db..00000000 --- a/schema/src/examples_builder.rs +++ /dev/null @@ -1,105 +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 std::fmt::Debug; - -use convert_case::{Case, Casing}; -use serde::Serialize; - -use crate::examples::{Example, ExampleData}; - -pub struct InMemoryExamplesBuilder { - examples: Vec, -} - -impl InMemoryExamplesBuilder { - pub fn new() -> Self { - Self { - examples: Vec::new(), - } - } - - pub fn add_example(mut self) -> Self - where - H: ExampleData, - I: Serialize + Clone + Debug, - O: Serialize + Clone + Debug, - { - let example = H::to_example(); - self.examples.push(example); - self - } - - pub fn build(&self) -> String { - let mut examples_markdown = Vec::::new(); - for example in self.examples.iter() { - let request_cleaned_name = example.request_type_name.strip_suffix("Request").unwrap(); - - let title = request_cleaned_name.to_case(Case::Title); - let function_name = request_cleaned_name.to_case(Case::Snake); - let jni_function_name = format!( - "Java_RadixEngineToolkitFFI_{}", - request_cleaned_name.to_case(Case::Camel) - ); - - let example_string = format!( - r#"## {} - -| Function Name | `{}` | -| ----------------- | :----------------- | -| JNI Function Name | `{}` | -| Functionality | {} | -| Required Features | {} | -| Request Type | `{}` | -| Response Type | `{}` | - -
- Request Example - -```json -{} -``` -
- -
- Response Example - -```json -{} -``` -
-"#, - title, - function_name, - jni_function_name, - example.request_description.replace('\n', "
"), - example.required_features, - example.request_type_name, - example.response_type_name, - example.request, - example.response, - ); - examples_markdown.push(example_string); - } - examples_markdown.insert(0, String::from(r#"# Requests Examples - -This document contains examples and descriptions of the different requests and responses which the Radix Engine Toolkit may provide. As long as all of the CI test pass, then you may treat this document as the canonical truth for the format of the different requests and as valid examples of the payload and responses of these requests. - -"#)); - examples_markdown.join("\n") - } -} diff --git a/schema/src/main.rs b/schema/src/main.rs deleted file mode 100644 index 0abef2a5..00000000 --- a/schema/src/main.rs +++ /dev/null @@ -1,178 +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 examples; -mod examples_builder; - -use std::collections::HashMap; -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 -macro_rules! generate_schema_hashmap { - ($($type: ty),*) => {{ - let mut map = HashMap::new(); - $( - { - // Converting type path to a type name by splitting it at the double colon and - // getting the type name - let type_name = stringify!($type).split("::").last().unwrap().trim().to_owned(); - - // Getting the schema for the type - let schema = schemars::schema_for!($type); - - // Adding it to the map - map.insert(type_name, schema); - } - )* - - map - }}; -} - -fn main() { - generate_json_schema().expect("Failed to generate schema"); - generate_request_examples().expect("Failed to generate request examples"); -} - -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!( - 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 - // schema to the file system - schema_map - .iter() - .map(|(struct_ident, schema)| { - ( - format!("{}.json", struct_ident.to_case(convert_case::Case::Snake)), - schema, - ) - }) - .map(|(file_name, schema)| { - let path = { - let mut path = PathBuf::from("."); - path.push("out"); - path.push("schema"); - path.push(file_name); - path - }; - - serde_json::to_string_pretty(schema) - .map_err(GenerationError::SerializationError) - .and_then(|schema_string| { - std::fs::write(path, schema_string).map_err(GenerationError::IOError) - }) - }) - .collect::, _>>()?; - - Ok(()) -} - -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::() - .build(); - - let path = { - let mut path = PathBuf::from("."); - path.push("out"); - path.push("examples"); - path.push("request-examples.md"); - path - }; - - std::fs::write(path, examples).map_err(GenerationError::IOError) -} - -#[derive(Debug)] -pub enum GenerationError { - IOError(std::io::Error), - SerializationError(serde_json::Error), -} diff --git a/test.sh b/test.sh new file mode 100755 index 00000000..f5b2cb2c --- /dev/null +++ b/test.sh @@ -0,0 +1,3 @@ +(cd radix-engine-toolkit-core; cargo nextest run) +(cd radix-engine-toolkit; cargo nextest run) +(cd radix-engine-toolkit-uniffi; cargo nextest run) \ No newline at end of file diff --git a/toolkit-derive/Cargo.toml b/toolkit-derive/Cargo.toml deleted file mode 100644 index 17544199..00000000 --- a/toolkit-derive/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "toolkit-derive" -version = "0.9.0" -edition = "2021" - -[dependencies] -proc-macro2 = { version = "1.0.49" } -quote = { version = "1.0.23" } -syn = { version = "1.0.107" } - -[lib] -proc-macro = true diff --git a/toolkit-derive/src/lib.rs b/toolkit-derive/src/lib.rs deleted file mode 100644 index 6e9c6d2f..00000000 --- a/toolkit-derive/src/lib.rs +++ /dev/null @@ -1,38 +0,0 @@ -extern crate proc_macro; - -use std::str::FromStr; - -use proc_macro::TokenStream; -use quote::quote; - -macro_rules! token_stream { - ($token: expr) => { - proc_macro2::TokenStream::from_str($token) - .expect("Failed to create token stream from trusted source") - }; -} - -#[proc_macro_attribute] -pub fn serializable(_: TokenStream, input: TokenStream) -> TokenStream { - let input = proc_macro2::TokenStream::from(input); - let json_schema_attribute = token_stream!("#[derive(schemars::JsonSchema)]"); - let serde_as_attribute = token_stream!("#[serde_with::serde_as]"); - let default_derive_attributes = - token_stream!("#[derive(serde::Serialize, serde::Deserialize)]"); - let derive_debug_attribute = token_stream!("#[derive(Debug)]"); - let derive_clone_attribute = token_stream!("#[derive(Clone)]"); - - TokenStream::from(quote! { - #json_schema_attribute - - #serde_as_attribute - - #default_derive_attributes - - #derive_debug_attribute - - #derive_clone_attribute - - #input - }) -} diff --git a/uniffi-bindgen/Cargo.toml b/uniffi-bindgen/Cargo.toml new file mode 100644 index 00000000..0dca83f4 --- /dev/null +++ b/uniffi-bindgen/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "uniffi-bindgen" +version = "0.10.0-elm.1" +edition = "2021" + +[dependencies] +uniffi = { git = "https://github.com/mozilla/uniffi-rs/", rev = "fe0d47ab23267415d118e5318feb282cc99ed5d0", features = ["cli"] } \ No newline at end of file diff --git a/uniffi-bindgen/rustfmt.toml b/uniffi-bindgen/rustfmt.toml new file mode 100644 index 00000000..a735b984 --- /dev/null +++ b/uniffi-bindgen/rustfmt.toml @@ -0,0 +1,3 @@ +unstable_features = true +wrap_comments = true +comment_width = 100 \ No newline at end of file diff --git a/uniffi-bindgen/src/main.rs b/uniffi-bindgen/src/main.rs new file mode 100644 index 00000000..b473e143 --- /dev/null +++ b/uniffi-bindgen/src/main.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. + +fn main() { + uniffi::uniffi_bindgen_main() +} diff --git a/uniffi_bindgen.sh b/uniffi_bindgen.sh new file mode 100755 index 00000000..6f4c7993 --- /dev/null +++ b/uniffi_bindgen.sh @@ -0,0 +1,18 @@ +bindgen() { + cargo run \ + --manifest-path="../uniffi-bindgen/Cargo.toml" -- \ + generate ./src/radix_engine_toolkit_uniffi.udl \ + --language $1 \ + --out-dir ./output \ + --lib-file ./target/debug/libradix_engine_toolkit_uniffi.a +} + +cd radix-engine-toolkit-uniffi; +cargo build + +bindgen swift +bindgen kotlin +bindgen python +bindgen ruby + +uniffi-bindgen-cs src/radix_engine_toolkit_uniffi.udl --lib-file ./target/debug/libradix_engine_toolkit_uniffi.a --out-dir output \ No newline at end of file diff --git a/update_test_manifests.py b/update_test_manifests.py new file mode 100644 index 00000000..6057604a --- /dev/null +++ b/update_test_manifests.py @@ -0,0 +1,76 @@ +import os +import shutil +import re + +SCRIPT_DIRECTORY: str = os.path.dirname(os.path.realpath(__file__)) +REPOSITORY_URL: str = "https://github.com/radixdlt/radixdlt-scrypto" +OUTPUT_DIRECTORIES: list[str] = [ + os.path.join(SCRIPT_DIRECTORY, "radix-engine-toolkit-core", "tests", "manifests"), + os.path.join(SCRIPT_DIRECTORY, "radix-engine-toolkit", "tests", "manifests"), +] + +def main() -> None: + # Get the tag or branch of the Scrypto dependency being used. + path_of_cargo_toml_manifest: str = os.path.join(SCRIPT_DIRECTORY, 'radix-engine-toolkit-core', 'Cargo.toml') + branch_or_tag: str = read_tag_or_version(path_of_cargo_toml_manifest) + + # Remove the radixdlt-scrypto if it exists + radixdlt_scrypto_directory: str = os.path.join(SCRIPT_DIRECTORY, 'radixdlt-scrypto') + if os.path.exists(radixdlt_scrypto_directory): + shutil.rmtree(radixdlt_scrypto_directory) + + # Clone the repository + os.system(f'git clone {REPOSITORY_URL} -b {branch_or_tag} "{radixdlt_scrypto_directory}"') + + # Copy the manifests from the path that they're at to the output path + manifests_path: str = os.path.join(radixdlt_scrypto_directory, 'transaction', 'examples') + for output_directory in OUTPUT_DIRECTORIES: + if os.path.exists(output_directory): + shutil.rmtree(output_directory) + shutil.copytree(manifests_path, output_directory) + + # Get and apply the needed replacements to the transaction manifests. + replacements: dict[str, str] = get_replacements(radixdlt_scrypto_directory) + for (root_directory, _, file_names) in os.walk(output_directory): + for file_name in file_names: + if not file_name.endswith('rtm'): + continue + + path: str = os.path.join(root_directory, file_name) + with open(path, 'r') as file: + content: str = file.read() + + for (old, new) in replacements.items(): + content = content.replace(old, new) + + with open(path, 'w') as file: + file.write(content) + + # Remove the radixdlt-scrypto repo after we're finished with it. + shutil.rmtree(radixdlt_scrypto_directory) + +def read_tag_or_version(manifest_path: str) -> str: + if not manifest_path.endswith('.toml'): + raise Exception("Invalid file extension") + + with open(manifest_path, 'r') as file: + contents: str = file.read() + + pattern: str = r'scrypto\s?=\s?\{.*[branch|tag]\s?=\s?"([\w\d\/-]*)".*\}' + return re.findall(pattern, contents)[0] + +def get_replacements(radixdlt_scrypto_directory: str) -> dict[str, str]: + replacements_file_path: str = os.path.join(radixdlt_scrypto_directory, 'transaction', 'src', 'manifest', 'e2e.rs') + + with open(replacements_file_path, 'r') as file: + content: str = file.read() + + pattern: str = r'\([\n\s\t]*"(.*?)",[\n\s\t]*"(.*?)",?[\n\s\t]*\)' + return { + key: value + for key, value + in re.findall(pattern, content) + } + +if __name__ == "__main__": + main() \ No newline at end of file